diff options
| author | LostDragonist <lost.dragonist@gmail.com> | 2019-04-15 04:11:06 -0500 |
|---|---|---|
| committer | LostDragonist <lost.dragonist@gmail.com> | 2019-04-15 05:25:22 -0500 |
| commit | 149c38d54d2a841af929b432b83804fafdc1e588 (patch) | |
| tree | 5fa69b73a3ec54df39444ce9bcd0e06a4a4a950b /src/executableslist.cpp | |
| parent | 0f13d9a4c00db48402dd70fcd55084d102582f22 (diff) | |
Add protection against non-existent working directory for executables
Diffstat (limited to 'src/executableslist.cpp')
| -rw-r--r-- | src/executableslist.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/executableslist.cpp b/src/executableslist.cpp index c7786c20..4b2e380b 100644 --- a/src/executableslist.cpp +++ b/src/executableslist.cpp @@ -57,7 +57,7 @@ void ExecutablesList::init(IPluginGame const *game) }
ExecutableInfo explorerpp = ExecutableInfo("Explore Virtual Folder", QFileInfo(QCoreApplication::applicationDirPath() + "/explorer++/Explorer++.exe" ))
.withArgument(QString("\"%1\"").arg(QDir::toNativeSeparators(game->dataDirectory().absolutePath())));
-
+
if (explorerpp.isValid()) {
addExecutableInternal(explorerpp.title(),
explorerpp.binary().absoluteFilePath(),
@@ -65,7 +65,7 @@ void ExecutablesList::init(IPluginGame const *game) explorerpp.workingDirectory().absolutePath(),
explorerpp.steamAppID());
}
-
+
}
void ExecutablesList::getExecutables(std::vector<Executable>::iterator &begin, std::vector<Executable>::iterator &end)
@@ -152,6 +152,7 @@ void ExecutablesList::updateExecutable(const QString &title, Executable::Flags flags)
{
QFileInfo file(executableName);
+ QDir dir(workingDirectory);
auto existingExe = findExe(title);
flags &= mask;
@@ -165,8 +166,11 @@ void ExecutablesList::updateExecutable(const QString &title, // don't overwrite a valid binary with an invalid one
existingExe->m_BinaryInfo = file;
}
+ if (dir.exists()) {
+ // don't overwrite a valid working directory with an invalid one
+ existingExe->m_WorkingDirectory = workingDirectory;
+ }
existingExe->m_Arguments = arguments;
- existingExe->m_WorkingDirectory = workingDirectory;
existingExe->m_SteamAppID = steamAppID;
}
} else {
|
