renamed startApplication() to runExecutableOrExecutableFile()

This commit is contained in:
isanae
2019-11-06 07:42:57 -05:00
parent e43500eaf5
commit b60f2aa786
4 changed files with 34 additions and 26 deletions
+2 -1
View File
@@ -653,7 +653,8 @@ int runApplication(MOApplication &application, SingleInstance &instance,
arguments.removeFirst(); // remove binary name
// pass the remaining parameters to the binary
try {
organizer.startApplication(exeName, arguments, QString(), QString());
organizer.runExecutableOrExecutableFile(
exeName, arguments, QString(), QString());
return 0;
}
catch (const std::exception &e) {
+19 -21
View File
@@ -1362,45 +1362,44 @@ HANDLE OrganizerCore::spawnAndWait(
return handle;
}
HANDLE OrganizerCore::startApplication(const QString &executable,
const QStringList &args,
const QString &cwd,
const QString &profile,
const QString &forcedCustomOverwrite,
bool ignoreCustomOverwrite)
HANDLE OrganizerCore::runExecutableOrExecutableFile(
const QString &executable, const QStringList &args, const QString &cwd,
const QString &profile, const QString &forcedCustomOverwrite,
bool ignoreCustomOverwrite)
{
QFileInfo binary;
QString arguments = args.join(" ");
QString currentDirectory = cwd;
QString profileName = profile;
if (profile.length() == 0) {
if (profile == "") {
if (m_CurrentProfile != nullptr) {
profileName = m_CurrentProfile->name();
} else {
throw MyException(tr("No profile set"));
}
}
QFileInfo binary;
QString arguments = args.join(" ");
QString currentDirectory = cwd;
QString steamAppID;
QString customOverwrite;
QList<ExecutableForcedLoadSetting> forcedLibraries;
if (executable.contains('\\') || executable.contains('/')) {
// file path
binary = QFileInfo(executable);
if (binary.isRelative()) {
// relative path, should be relative to game directory
binary = QFileInfo(
managedGame()->gameDirectory().absoluteFilePath(executable));
binary = managedGame()->gameDirectory().absoluteFilePath(executable);
}
if (cwd.length() == 0) {
if (currentDirectory == "") {
currentDirectory = binary.absolutePath();
}
try {
const Executable &exe = m_ExecutablesList.getByBinary(binary);
const Executable& exe = m_ExecutablesList.getByBinary(binary);
steamAppID = exe.steamAppID();
customOverwrite
= m_CurrentProfile->setting("custom_overwrites", exe.title())
.toString();
customOverwrite = m_CurrentProfile->setting("custom_overwrites", exe.title()).toString();
if (m_CurrentProfile->forcedLibrariesEnabled(exe.title())) {
forcedLibraries = m_CurrentProfile->determineForcedLibraries(exe.title());
}
@@ -1412,9 +1411,7 @@ HANDLE OrganizerCore::startApplication(const QString &executable,
try {
const Executable &exe = m_ExecutablesList.get(executable);
steamAppID = exe.steamAppID();
customOverwrite
= m_CurrentProfile->setting("custom_overwrites", exe.title())
.toString();
customOverwrite = m_CurrentProfile->setting("custom_overwrites", exe.title()).toString();
if (m_CurrentProfile->forcedLibrariesEnabled(exe.title())) {
forcedLibraries = m_CurrentProfile->determineForcedLibraries(exe.title());
}
@@ -1422,7 +1419,7 @@ HANDLE OrganizerCore::startApplication(const QString &executable,
arguments = exe.arguments();
}
binary = exe.binaryInfo();
if (cwd.length() == 0) {
if (currentDirectory == "") {
currentDirectory = exe.workingDirectory();
}
} catch (const std::runtime_error &) {
@@ -1433,6 +1430,7 @@ HANDLE OrganizerCore::startApplication(const QString &executable,
if (!forcedCustomOverwrite.isEmpty())
customOverwrite = forcedCustomOverwrite;
if (ignoreCustomOverwrite)
customOverwrite.clear();
+6 -1
View File
@@ -174,6 +174,12 @@ public:
bool runShortcut(const MOShortcut& shortcut);
HANDLE runExecutableOrExecutableFile(
const QString &executable, const QStringList &args, const QString &cwd,
const QString &profile, const QString &forcedCustomOverwrite = "",
bool ignoreCustomOverwrite = false);
void loginSuccessfulUpdate(bool necessary);
void loginFailedUpdate(const QString &message);
@@ -227,7 +233,6 @@ public:
DownloadManager *downloadManager();
PluginList *pluginList();
ModList *modList();
HANDLE startApplication(const QString &executable, const QStringList &args, const QString &cwd, const QString &profile, const QString &forcedCustomOverwrite = "", bool ignoreCustomOverwrite = false);
bool waitForApplication(HANDLE processHandle, LPDWORD exitCode = nullptr);
HANDLE findAndOpenAUSVFSProcess(const std::vector<QString>& hiddenList, DWORD preferedParentPid);
bool onModInstalled(const std::function<void (const QString &)> &func);
+7 -3
View File
@@ -107,10 +107,14 @@ QString OrganizerProxy::pluginDataPath() const
return m_Proxied->pluginDataPath();
}
HANDLE OrganizerProxy::startApplication(const QString &executable, const QStringList &args, const QString &cwd,
const QString &profile, const QString &forcedCustomOverwrite, bool ignoreCustomOverwrite)
HANDLE OrganizerProxy::startApplication(
const QString &executable, const QStringList &args, const QString &cwd,
const QString &profile, const QString &forcedCustomOverwrite,
bool ignoreCustomOverwrite)
{
return m_Proxied->startApplication(executable, args, cwd, profile, forcedCustomOverwrite, ignoreCustomOverwrite);
return m_Proxied->runExecutableOrExecutableFile(
executable, args, cwd, profile,
forcedCustomOverwrite, ignoreCustomOverwrite);
}
bool OrganizerProxy::waitForApplication(HANDLE handle, LPDWORD exitCode) const