summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTannin <sherb@gmx.net>2016-06-23 21:00:46 +0200
committerTannin <sherb@gmx.net>2016-06-23 21:00:46 +0200
commit8a3af93b39b05b95462869fc7df7169c5862c966 (patch)
tree450d2e663e6224f7e57d95655fca5fddd8416c1b /src
parent352975e757f5e68e1e1d2738ab0cb2e9ac5b31dc (diff)
fixed creation of data paths after changing paths in settings and update of profile list after change
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp49
-rw-r--r--src/mainwindow.cpp1
-rw-r--r--src/modinfooverwrite.cpp3
-rw-r--r--src/organizer_en.ts149
-rw-r--r--src/organizercore.cpp35
-rw-r--r--src/organizercore.h4
-rw-r--r--src/pluginlist.cpp10
-rw-r--r--src/settings.cpp10
-rw-r--r--src/settingsdialog.ui7
9 files changed, 154 insertions, 114 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 6b585b5c..16b6b80f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -85,38 +85,21 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
using namespace MOBase;
using namespace MOShared;
-
-bool createAndMakeWritable(const std::wstring &subPath)
-{
+bool createAndMakeWritable(const std::wstring &subPath) {
QString const dataPath = qApp->property("dataPath").toString();
QString fullPath = dataPath + "/" + QString::fromStdWString(subPath);
- if (!QDir(fullPath).exists()) {
- QDir().mkdir(fullPath);
- }
-
- QFileInfo fileInfo(fullPath);
- if (!fileInfo.exists() || !fileInfo.isWritable()) {
- if (QMessageBox::question(nullptr, QObject::tr("Permissions required"),
- QObject::tr("The current user account doesn't have the required access rights to run "
- "Mod Organizer. The neccessary changes can be made automatically (the MO directory "
- "will be made writable for the current user account). You will be asked to run "
- "\"helper.exe\" with administrative rights."),
- QMessageBox::Yes | QMessageBox::Cancel) == QMessageBox::Yes) {
- if (!Helper::init(qApp->applicationDirPath().toStdWString(),
- dataPath.toStdWString())) {
- return false;
- }
- } else {
- return false;
- }
- // no matter which directory didn't exist/wasn't writable, the helper
- // should have created them all so we don't have to worry this message box would appear repeatedly
+ if (!QDir(fullPath).exists() && !QDir().mkdir(fullPath)) {
+ QMessageBox::critical(nullptr, QObject::tr("Error"),
+ QObject::tr("Failed to create \"%1\". Your user "
+ "account probably lacks permission.")
+ .arg(fullPath));
+ return false;
+ } else {
+ return true;
}
- return true;
}
-
bool bootstrap()
{
// remove the temporary backup directory in case we're restarting after an update
@@ -129,11 +112,9 @@ bool bootstrap()
removeOldFiles(qApp->property("dataPath").toString() + "/" + QString::fromStdWString(AppConfig::logPath()),
"usvfs*.log", 5, QDir::Name);
- createAndMakeWritable(AppConfig::profilesPath());
- createAndMakeWritable(AppConfig::modsPath());
- createAndMakeWritable(AppConfig::downloadPath());
- createAndMakeWritable(AppConfig::overwritePath());
- createAndMakeWritable(AppConfig::logPath());
+ if (!createAndMakeWritable(AppConfig::logPath())) {
+ return false;
+ }
return true;
}
@@ -445,7 +426,7 @@ int runApplication(MOApplication &application, SingleInstance &instance,
qDebug("data path: %s", qPrintable(dataPath));
if (!bootstrap()) {
- reportError("failed to set up data path");
+ reportError("failed to set up data paths");
return 1;
}
@@ -465,6 +446,10 @@ int runApplication(MOApplication &application, SingleInstance &instance,
QSettings::IniFormat);
qDebug("initializing core");
OrganizerCore organizer(settings);
+ if (!organizer.bootstrap()) {
+ reportError("failed to set up data paths");
+ return 1;
+ }
qDebug("initialize plugins");
PluginContainer pluginContainer(&organizer);
pluginContainer.loadPlugins();
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index c90448c2..b7687d2a 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -3197,6 +3197,7 @@ void MainWindow::on_actionSettings_triggered()
m_OrganizerCore.installationManager()->setDownloadDirectory(m_OrganizerCore.settings().getDownloadDirectory());
fixCategories();
refreshFilters();
+ refreshProfiles();
if (QDir::fromNativeSeparators(m_OrganizerCore.downloadManager()->getOutputDirectory()) != QDir::fromNativeSeparators(m_OrganizerCore.settings().getDownloadDirectory())) {
if (m_OrganizerCore.downloadManager()->downloadsInProgress()) {
MessageDialog::showMessage(tr("Can't change download directory while downloads are in progress!"), this);
diff --git a/src/modinfooverwrite.cpp b/src/modinfooverwrite.cpp
index 4380a255..0104998a 100644
--- a/src/modinfooverwrite.cpp
+++ b/src/modinfooverwrite.cpp
@@ -1,6 +1,7 @@
#include "modinfooverwrite.h"
#include "appconfig.h"
+#include "settings.h"
#include <QApplication>
#include <QDirIterator>
@@ -21,7 +22,7 @@ bool ModInfoOverwrite::isEmpty() const
QString ModInfoOverwrite::absolutePath() const
{
- return QDir::fromNativeSeparators(qApp->property("dataPath").toString() + "/" + QString::fromStdWString(AppConfig::overwritePath()));
+ return Settings::instance().getOverwriteDirectory();
}
std::vector<ModInfo::EFlag> ModInfoOverwrite::getFlags() const
diff --git a/src/organizer_en.ts b/src/organizer_en.ts
index 7920c98b..686e15db 100644
--- a/src/organizer_en.ts
+++ b/src/organizer_en.ts
@@ -2629,62 +2629,62 @@ This function will guess the versioning scheme under the assumption that the ins
<context>
<name>ModInfo</name>
<message>
- <location filename="modinfo.cpp" line="90"/>
+ <location filename="modinfo.cpp" line="93"/>
<source>Plugins</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="modinfo.cpp" line="91"/>
+ <location filename="modinfo.cpp" line="94"/>
<source>Textures</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="modinfo.cpp" line="92"/>
+ <location filename="modinfo.cpp" line="95"/>
<source>Meshes</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="modinfo.cpp" line="93"/>
+ <location filename="modinfo.cpp" line="96"/>
<source>BSA</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="modinfo.cpp" line="94"/>
+ <location filename="modinfo.cpp" line="97"/>
<source>UI Changes</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="modinfo.cpp" line="95"/>
+ <location filename="modinfo.cpp" line="98"/>
<source>Sound Effects</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="modinfo.cpp" line="96"/>
+ <location filename="modinfo.cpp" line="99"/>
<source>Scripts</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="modinfo.cpp" line="97"/>
+ <location filename="modinfo.cpp" line="100"/>
<source>SKSE Plugins</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="modinfo.cpp" line="98"/>
+ <location filename="modinfo.cpp" line="101"/>
<source>SkyProc Tools</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="modinfo.cpp" line="99"/>
+ <location filename="modinfo.cpp" line="102"/>
<source>invalid content type %1</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="modinfo.cpp" line="122"/>
+ <location filename="modinfo.cpp" line="125"/>
<source>invalid mod index %1</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="modinfo.cpp" line="151"/>
+ <location filename="modinfo.cpp" line="154"/>
<source>remove: invalid mod index %1</source>
<translation type="unfinished"></translation>
</message>
@@ -3225,7 +3225,7 @@ p, li { white-space: pre-wrap; }
<context>
<name>ModInfoOverwrite</name>
<message>
- <location filename="modinfooverwrite.cpp" line="41"/>
+ <location filename="modinfooverwrite.cpp" line="42"/>
<source>This pseudo mod contains files from the virtual data tree that got modified (i.e. by the construction kit)</source>
<translation type="unfinished"></translation>
</message>
@@ -4630,17 +4630,17 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="spawn.cpp" line="144"/>
+ <location filename="spawn.cpp" line="143"/>
<source>failed to spawn &quot;%1&quot;</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="spawn.cpp" line="151"/>
+ <location filename="spawn.cpp" line="150"/>
<source>Elevation required</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="spawn.cpp" line="152"/>
+ <location filename="spawn.cpp" line="151"/>
<source>This process requires elevation to run.
This is a potential security risk so I highly advice you to investigate if
&quot;%1&quot;
@@ -4650,7 +4650,7 @@ Start elevated anyway? (you will be asked if you want to allow ModOrganizer.exe
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="spawn.cpp" line="167"/>
+ <location filename="spawn.cpp" line="166"/>
<source>failed to spawn &quot;%1&quot;: %2</source>
<translation type="unfinished"></translation>
</message>
@@ -5037,23 +5037,28 @@ If you use pre-releases, never contact me directly by e-mail or via private mess
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="368"/>
+ <location filename="settingsdialog.ui" line="355"/>
+ <source>Use %BASE_DIR% to refer to the Base Directory.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="settingsdialog.ui" line="375"/>
<source>Important: All directories have to be writeable!</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="376"/>
- <location filename="settingsdialog.ui" line="392"/>
+ <location filename="settingsdialog.ui" line="383"/>
+ <location filename="settingsdialog.ui" line="399"/>
<source>Nexus</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="382"/>
+ <location filename="settingsdialog.ui" line="389"/>
<source>Allows automatic log-in when the Nexus-Page for the game is clicked.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="385"/>
+ <location filename="settingsdialog.ui" line="392"/>
<source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
@@ -5062,144 +5067,144 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="401"/>
+ <location filename="settingsdialog.ui" line="408"/>
<source>If checked and if correct credentials are entered below, log-in to Nexus (for browsing and downloading) is automatic.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="404"/>
+ <location filename="settingsdialog.ui" line="411"/>
<source>Automatically Log-In to Nexus</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="413"/>
- <location filename="settingsdialog.ui" line="599"/>
+ <location filename="settingsdialog.ui" line="420"/>
+ <location filename="settingsdialog.ui" line="606"/>
<source>Username</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="427"/>
- <location filename="settingsdialog.ui" line="609"/>
+ <location filename="settingsdialog.ui" line="434"/>
+ <location filename="settingsdialog.ui" line="616"/>
<source>Password</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="448"/>
+ <location filename="settingsdialog.ui" line="455"/>
<source>Remove cache and cookies. Forces a new login.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="451"/>
+ <location filename="settingsdialog.ui" line="458"/>
<source>Clear Cache</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="480"/>
+ <location filename="settingsdialog.ui" line="487"/>
<source>Disable automatic internet features</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="483"/>
+ <location filename="settingsdialog.ui" line="490"/>
<source>Disable automatic internet features. This does not affect features that are explicitly invoked by the user (like checking mods for updates, endorsing, opening the web browser)</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="486"/>
+ <location filename="settingsdialog.ui" line="493"/>
<source>Offline Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="493"/>
+ <location filename="settingsdialog.ui" line="500"/>
<source>Use a proxy for network connections.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="496"/>
+ <location filename="settingsdialog.ui" line="503"/>
<source>Use a proxy for network connections. This uses the system-wide settings which can be configured in Internet Explorer. Please note that MO will start up a few seconds slower on some systems when using a proxy.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="499"/>
+ <location filename="settingsdialog.ui" line="506"/>
<source>Use HTTP Proxy (Uses System Settings)</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="508"/>
+ <location filename="settingsdialog.ui" line="515"/>
<source>Associate with &quot;Download with manager&quot; links</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="537"/>
+ <location filename="settingsdialog.ui" line="544"/>
<source>Known Servers (updated on download)</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="558"/>
+ <location filename="settingsdialog.ui" line="565"/>
<source>Preferred Servers (Drag &amp; Drop)</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="593"/>
+ <location filename="settingsdialog.ui" line="600"/>
<source>Steam</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="639"/>
+ <location filename="settingsdialog.ui" line="646"/>
<source>If you save your steam user ID and password here, they will be used when logging into steam. Note, however, your password will be stored unencrypted, so make sure your computer is secure.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="666"/>
+ <location filename="settingsdialog.ui" line="673"/>
<source>Plugins</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="688"/>
+ <location filename="settingsdialog.ui" line="695"/>
<source>Author:</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="702"/>
+ <location filename="settingsdialog.ui" line="709"/>
<source>Version:</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="716"/>
+ <location filename="settingsdialog.ui" line="723"/>
<source>Description:</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="754"/>
+ <location filename="settingsdialog.ui" line="761"/>
<source>Key</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="759"/>
+ <location filename="settingsdialog.ui" line="766"/>
<source>Value</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="771"/>
+ <location filename="settingsdialog.ui" line="778"/>
<source>Blacklisted Plugins (use &lt;del&gt; to remove):</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="782"/>
+ <location filename="settingsdialog.ui" line="789"/>
<source>Workarounds</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="790"/>
+ <location filename="settingsdialog.ui" line="797"/>
<source>Steam App ID</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="810"/>
+ <location filename="settingsdialog.ui" line="817"/>
<source>The Steam AppID for your game</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="813"/>
+ <location filename="settingsdialog.ui" line="820"/>
<source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
@@ -5215,17 +5220,17 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="844"/>
+ <location filename="settingsdialog.ui" line="851"/>
<source>Load Mechanism</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="864"/>
+ <location filename="settingsdialog.ui" line="871"/>
<source>Select loading mechanism. See help for details.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="867"/>
+ <location filename="settingsdialog.ui" line="874"/>
<source>Mod Organizer needs a dll to be injected into the game so all mods are visible to it.
There are several means to do this:
*Mod Organizer* (default) In this mode the Mod Organizer itself injects the dll. The disadvantage is that you always have to start the game through MO or a link created by it.
@@ -5236,17 +5241,17 @@ If you use the Steam version of Oblivion the default will NOT work. In this case
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="884"/>
+ <location filename="settingsdialog.ui" line="891"/>
<source>NMM Version</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="904"/>
+ <location filename="settingsdialog.ui" line="911"/>
<source>The Version of Nexus Mod Manager to impersonate.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="907"/>
+ <location filename="settingsdialog.ui" line="914"/>
<source>Mod Organizer uses an API provided by the Nexus to provide features like checking for updates and downloading files. Unfortunately this API has not been made available officially to third party tools like MO so we have to impersonate the Nexus Mod Manager to be allowed in.
On top of this Nexus has used the client identification to lock out outdated versions of NMM to force users to update. This means that MO also needs to impersonate the new version of NMM even if MO doesn&apos;t need an update. Therefore you can configure the version to identify as here.
Please note that MO does identify itself as MO to the webserver, it&apos;s not lying about what it is. It is merely adding a &quot;compatible&quot; NMM version to the user agent.
@@ -5255,44 +5260,44 @@ tl;dr-version: If Nexus-features don&apos;t work, insert the current version num
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="929"/>
+ <location filename="settingsdialog.ui" line="936"/>
<source>Enforces that inactive ESPs and ESMs are never loaded.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="932"/>
+ <location filename="settingsdialog.ui" line="939"/>
<source>It seems that the Games occasionally load ESP or ESM files even if they haven&apos;t been activated as plugins.
I don&apos;t yet know what the circumstances are, but user reports imply it is in some cases unwanted. If this is checked, ESPs and ESMs not checked in the List are invisible to the game and can not be loaded.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="936"/>
+ <location filename="settingsdialog.ui" line="943"/>
<source>Hide inactive ESPs/ESMs</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="943"/>
+ <location filename="settingsdialog.ui" line="950"/>
<source>If checked, files (i.e. esps, esms and bsas) belonging to the core game can not be disabled in the UI. (default: on)</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="946"/>
+ <location filename="settingsdialog.ui" line="953"/>
<source>If checked, files (i.e. esps, esms and bsas) belonging to the core game can not be disabled in the UI. (default: on)
Uncheck this if you want to use Mod Organizer with total conversions (like Nehrim) but be aware that the game will crash if required files are not enabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="950"/>
+ <location filename="settingsdialog.ui" line="957"/>
<source>Force-enable game files</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="960"/>
+ <location filename="settingsdialog.ui" line="967"/>
<source>Disable this to no longer display mods installed outside MO in the mod list (left pane). Assets from those mods will then be treated as having lowest mod priority together with the original game content.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="963"/>
+ <location filename="settingsdialog.ui" line="970"/>
<source>By default Mod Organizer will display esp+bsa bundles installed with foreign tools as mods (left pane). This allows you to control their priority in relation to other mods. This is particularly useful if you also use Steam Workshop to install mods.
However, if you installed loose file mods outside MO which conflict with BSAs also installed outside MO those conflicts can&apos;t be resolved correctly.
@@ -5300,24 +5305,24 @@ If you disable this feature, MO will only display official DLCs this way. Please
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="969"/>
+ <location filename="settingsdialog.ui" line="976"/>
<source>Display mods installed outside MO</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="979"/>
- <location filename="settingsdialog.ui" line="983"/>
+ <location filename="settingsdialog.ui" line="986"/>
+ <location filename="settingsdialog.ui" line="990"/>
<source>For Skyrim, this can be used instead of Archive Invalidation. It should make AI redundant for all Profiles.
For the other games this is not a sufficient replacement for AI!</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="987"/>
+ <location filename="settingsdialog.ui" line="994"/>
<source>Back-date BSAs</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="settingsdialog.ui" line="1011"/>
+ <location filename="settingsdialog.ui" line="1018"/>
<source>These are workarounds for problems with Mod Organizer. Please make sure you read the help text before changing anything here.</source>
<translation type="unfinished"></translation>
</message>
@@ -5558,7 +5563,7 @@ On Windows XP:
<context>
<name>UsvfsConnector</name>
<message>
- <location filename="usvfsconnector.cpp" line="136"/>
+ <location filename="usvfsconnector.cpp" line="135"/>
<source>Preparing vfs</source>
<translation type="unfinished"></translation>
</message>
diff --git a/src/organizercore.cpp b/src/organizercore.cpp
index 6ceefb4b..b5e5118d 100644
--- a/src/organizercore.cpp
+++ b/src/organizercore.cpp
@@ -586,6 +586,25 @@ InstallationManager *OrganizerCore::installationManager()
return &m_InstallationManager;
}
+bool OrganizerCore::createDirectory(const QString &path) {
+ if (!QDir(path).exists() && !QDir().mkpath(path)) {
+ QMessageBox::critical(nullptr, QObject::tr("Error"),
+ QObject::tr("Failed to create \"%1\". Your user "
+ "account probably lacks permission.")
+ .arg(QDir::toNativeSeparators(path)));
+ return false;
+ } else {
+ return true;
+ }
+}
+
+bool OrganizerCore::bootstrap() {
+ return createDirectory(m_Settings.getProfileDirectory()) &&
+ createDirectory(m_Settings.getModDirectory()) &&
+ createDirectory(m_Settings.getDownloadDirectory()) &&
+ createDirectory(m_Settings.getOverwriteDirectory());
+}
+
void OrganizerCore::createDefaultProfile()
{
QString profilesPath = settings().getProfileDirectory();
@@ -610,7 +629,19 @@ void OrganizerCore::setCurrentProfile(const QString &profileName)
&& (profileName == m_CurrentProfile->name())) {
return;
}
- QString profileDir = settings().getProfileDirectory() + "/" + profileName;
+
+ QDir profileBaseDir(settings().getProfileDirectory());
+ QString profileDir = profileBaseDir.absoluteFilePath(profileName);
+
+ if (!QDir(profileDir).exists()) {
+ // selected profile doesn't exist. Ensure there is at least one profile,
+ // then pick any one
+ createDefaultProfile();
+
+ profileDir = profileBaseDir.absoluteFilePath(
+ profileBaseDir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot).at(0));
+ }
+
Profile *newProfile = new Profile(QDir(profileDir), managedGame());
delete m_CurrentProfile;
@@ -1870,7 +1901,7 @@ std::vector<Mapping> OrganizerCore::fileMapping(const QString &profileName,
result.insert(result.end(), {
QDir::toNativeSeparators(m_Settings.getOverwriteDirectory()),
- QDir::toNativeSeparators(game->dataDirectory().absolutePath()),
+ dataPath,
true,
customOverwrite.isEmpty()
});
diff --git a/src/organizercore.h b/src/organizercore.h
index ecb02d83..6c882dc9 100644
--- a/src/organizercore.h
+++ b/src/organizercore.h
@@ -135,6 +135,8 @@ public:
void loginSuccessfulUpdate(bool necessary);
void loginFailedUpdate(const QString &message);
+ static bool createAndMakeWritable(const QString &path);
+ bool bootstrap();
void createDefaultProfile();
MOBase::DelayedFileWriter &pluginsWriter() { return m_PluginListsWriter; }
@@ -228,6 +230,8 @@ private:
bool testForSteam();
+ bool createDirectory(const QString &path);
+
/**
* @brief return a descriptor of the mappings real file->virtual file
*/
diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp
index bc6a908e..44e08023 100644
--- a/src/pluginlist.cpp
+++ b/src/pluginlist.cpp
@@ -237,8 +237,8 @@ void PluginList::enableAll()
{
if (QMessageBox::question(nullptr, tr("Confirm"), tr("Really enable all plugins?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
- for (std::vector<ESPInfo>::iterator iter = m_ESPs.begin(); iter != m_ESPs.end(); ++iter) {
- iter->m_Enabled = true;
+ for (ESPInfo &info : m_ESPs) {
+ info.m_Enabled = true;
}
emit writePluginsList();
}
@@ -249,9 +249,9 @@ void PluginList::disableAll()
{
if (QMessageBox::question(nullptr, tr("Confirm"), tr("Really disable all plugins?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
- for (std::vector<ESPInfo>::iterator iter = m_ESPs.begin(); iter != m_ESPs.end(); ++iter) {
- if (!iter->m_ForceEnabled) {
- iter->m_Enabled = false;
+ for (ESPInfo &info : m_ESPs) {
+ if (!info.m_ForceEnabled) {
+ info.m_Enabled = false;
}
}
emit writePluginsList();
diff --git a/src/settings.cpp b/src/settings.cpp
index 193c6a35..b86e2289 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -32,6 +32,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QDirIterator>
#include <QLineEdit>
#include <QMessageBox>
+#include <QApplication>
#include <QRegExp>
#include <QDir>
@@ -701,10 +702,15 @@ void Settings::PathsTab::update()
settingsKey = QString("Settings/%1").arg(settingsKey);
QString realPath = path;
- realPath.replace("%BASE_DIR%", m_parent->getBaseDirectory());
+ realPath.replace("%BASE_DIR%", m_baseDirEdit->text());
if (!QDir(realPath).exists()) {
- QDir().mkpath(realPath);
+ if (!QDir().mkpath(realPath)) {
+ QMessageBox::warning(qApp->activeWindow(), tr("Error"),
+ tr("Failed to create \"%1\", you may not have the "
+ "necessary permission. path remains unchanged.")
+ .arg(realPath));
+ }
}
if (QFileInfo(realPath)
diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui
index 082be8a1..a38530da 100644
--- a/src/settingsdialog.ui
+++ b/src/settingsdialog.ui
@@ -350,6 +350,13 @@ If you use pre-releases, never contact me directly by e-mail or via private mess
</layout>
</item>
<item>
+ <widget class="QLabel" name="label_26">
+ <property name="text">
+ <string>Use %BASE_DIR% to refer to the Base Directory.</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>