summaryrefslogtreecommitdiffstats
path: root/MultiMC.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-01-05 16:47:12 +0100
committerPetr Mrázek <peterix@gmail.com>2014-01-05 16:47:12 +0100
commit0dcf694c8776ac03779e465bdc4859fba9be314d (patch)
tree25c742f97a98fb7534f8a2180f5b7b165bf7e8c5 /MultiMC.cpp
parenta64eebf8eb758971b090b2e87212c2458424797e (diff)
downloadMultiMC-0dcf694c8776ac03779e465bdc4859fba9be314d.tar
MultiMC-0dcf694c8776ac03779e465bdc4859fba9be314d.tar.gz
MultiMC-0dcf694c8776ac03779e465bdc4859fba9be314d.tar.lz
MultiMC-0dcf694c8776ac03779e465bdc4859fba9be314d.tar.xz
MultiMC-0dcf694c8776ac03779e465bdc4859fba9be314d.zip
More updater fixage
Preserve --dir parameter after updating Allow more than one copy of a command line parameter in MultiMC Linux runner script no longer changes current directory, which allows '--dir .' Fixed unit tests, removed the obsolete one (for some legacy updater command line params that were also removed) [fixes 63127704]
Diffstat (limited to 'MultiMC.cpp')
-rw-r--r--MultiMC.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/MultiMC.cpp b/MultiMC.cpp
index 2bc77e0f..5ca1e1c6 100644
--- a/MultiMC.cpp
+++ b/MultiMC.cpp
@@ -37,7 +37,7 @@
using namespace Util::Commandline;
-MultiMC::MultiMC(int &argc, char **argv, const QString &data_dir_override)
+MultiMC::MultiMC(int &argc, char **argv, bool root_override)
: QApplication(argc, argv), m_version{VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD,
VERSION_CHANNEL, VERSION_BUILD_TYPE}
{
@@ -111,14 +111,7 @@ MultiMC::MultiMC(int &argc, char **argv, const QString &data_dir_override)
QString adjustedBy;
// change directory
QString dirParam = args["dir"].toString();
- if (!data_dir_override.isEmpty())
- {
- // the override is used for tests (although dirparam would be enough...)
- // TODO: remove the need for this extra logic
- adjustedBy += "Test override " + data_dir_override;
- dataPath = data_dir_override;
- }
- else if (!dirParam.isEmpty())
+ if (!dirParam.isEmpty())
{
// the dir param. it makes multimc data path point to whatever the user specified
// on command line
@@ -130,6 +123,7 @@ MultiMC::MultiMC(int &argc, char **argv, const QString &data_dir_override)
dataPath = applicationDirPath();
adjustedBy += "Fallback to binary path " + dataPath;
}
+
if(!ensureFolderPathExists(dataPath) || !QDir::setCurrent(dataPath))
{
// BAD STUFF. WHAT DO?
@@ -139,6 +133,11 @@ MultiMC::MultiMC(int &argc, char **argv, const QString &data_dir_override)
return;
}
+ if (root_override)
+ {
+ rootPath = binPath;
+ }
+ else
{
#ifdef Q_OS_LINUX
QDir foo(PathCombine(binPath, ".."));
@@ -539,7 +538,7 @@ void MultiMC::installUpdates(const QString updateFilesDir, UpdateFlags flags)
#else
#error Unsupported operating system.
#endif
-
+
QStringList args;
// ./updater --install-dir $INSTALL_DIR --package-dir $UPDATEFILES_DIR --script
// $UPDATEFILES_DIR/file_list.xml --wait $PID --mode main
@@ -550,8 +549,10 @@ void MultiMC::installUpdates(const QString updateFilesDir, UpdateFlags flags)
if(flags & DryRun)
args << "--dry-run";
if (flags & RestartOnFinish)
+ {
args << "--finish-cmd" << finishCmd;
-
+ args << "--finish-dir" << data();
+ }
QLOG_INFO() << "Running updater with command" << updaterBinary << args.join(" ");
QFile::setPermissions(updaterBinary, (QFileDevice::Permission)0x7755);