diff options
| author | LostDragonist <lost.dragonist@gmail.com> | 2019-05-03 21:32:33 -0500 |
|---|---|---|
| committer | LostDragonist <lost.dragonist@gmail.com> | 2019-05-03 21:32:33 -0500 |
| commit | 179a73857125ee604f42b0d5c2d765183c86d2c7 (patch) | |
| tree | b9b3f9d62bd5640de839d150a53ab8ef119dab9c /src/executableslist.cpp | |
| parent | e2b799bd6b5cfd51969fefd1dab5e5b1b7e5f81c (diff) | |
| parent | 907c5468424b48774f5da2a6b5f96f26590987b0 (diff) | |
Merge pull request #695 from ModOrganizer2/Develop
Stage for Release 2.2.0
Diffstat (limited to 'src/executableslist.cpp')
| -rw-r--r-- | src/executableslist.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/executableslist.cpp b/src/executableslist.cpp index 21cb6ed4..4b2e380b 100644 --- a/src/executableslist.cpp +++ b/src/executableslist.cpp @@ -25,6 +25,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <QFileInfo>
#include <QDir>
#include <QDebug>
+#include <QCoreApplication>
+
#include <algorithm>
@@ -53,6 +55,17 @@ void ExecutablesList::init(IPluginGame const *game) info.steamAppID());
}
}
+ 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(),
+ explorerpp.arguments().join(" "),
+ explorerpp.workingDirectory().absolutePath(),
+ explorerpp.steamAppID());
+ }
+
}
void ExecutablesList::getExecutables(std::vector<Executable>::iterator &begin, std::vector<Executable>::iterator &end)
@@ -75,7 +88,7 @@ const Executable &ExecutablesList::find(const QString &title) const return exe;
}
}
- throw std::runtime_error(QString("invalid name %1").arg(title).toLocal8Bit().constData());
+ throw std::runtime_error(QString("invalid executable name: %1").arg(title).toLocal8Bit().constData());
}
@@ -86,7 +99,7 @@ Executable &ExecutablesList::find(const QString &title) return exe;
}
}
- throw std::runtime_error(QString("invalid executable name %1").arg(title).toLocal8Bit().constData());
+ throw std::runtime_error(QString("invalid executable name: %1").arg(title).toLocal8Bit().constData());
}
@@ -139,6 +152,7 @@ void ExecutablesList::updateExecutable(const QString &title, Executable::Flags flags)
{
QFileInfo file(executableName);
+ QDir dir(workingDirectory);
auto existingExe = findExe(title);
flags &= mask;
@@ -152,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 {
|
