summaryrefslogtreecommitdiffstats
path: root/logic/updater
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-06-09 23:23:46 +0200
committerPetr Mrázek <peterix@gmail.com>2015-06-09 23:30:28 +0200
commit15b7c3039a41eab75f5dcabab53de82372d2ecfa (patch)
treea8d88e39460954372c3f40c409bf20ffb728cb51 /logic/updater
parent22c5ced5dc162a78876d15d1ac1dd67edcf47b72 (diff)
downloadMultiMC-15b7c3039a41eab75f5dcabab53de82372d2ecfa.tar
MultiMC-15b7c3039a41eab75f5dcabab53de82372d2ecfa.tar.gz
MultiMC-15b7c3039a41eab75f5dcabab53de82372d2ecfa.tar.lz
MultiMC-15b7c3039a41eab75f5dcabab53de82372d2ecfa.tar.xz
MultiMC-15b7c3039a41eab75f5dcabab53de82372d2ecfa.zip
GH-1060 update tweaks
* download to multimc folder hierarchy * use rename, not copy * keep backup after update * clean previous backup before update * it's not 'copy', it's 'replace'
Diffstat (limited to 'logic/updater')
-rw-r--r--logic/updater/DownloadTask.cpp4
-rw-r--r--logic/updater/DownloadTask.h7
-rw-r--r--logic/updater/GoUpdate.h4
3 files changed, 10 insertions, 5 deletions
diff --git a/logic/updater/DownloadTask.cpp b/logic/updater/DownloadTask.cpp
index 4a42f583..76741748 100644
--- a/logic/updater/DownloadTask.cpp
+++ b/logic/updater/DownloadTask.cpp
@@ -27,8 +27,8 @@
namespace GoUpdate
{
-DownloadTask::DownloadTask(Status status, QObject *parent)
- : Task(parent)
+DownloadTask::DownloadTask(Status status, QString target, QObject *parent)
+ : Task(parent), m_updateFilesDir(target)
{
m_status = status;
diff --git a/logic/updater/DownloadTask.h b/logic/updater/DownloadTask.h
index 3bc504fc..d77c2b2c 100644
--- a/logic/updater/DownloadTask.h
+++ b/logic/updater/DownloadTask.h
@@ -30,7 +30,12 @@ class DownloadTask : public Task
Q_OBJECT
public:
- explicit DownloadTask(Status status, QObject* parent = 0);
+ /**
+ * Create a download task
+ *
+ * target is a template - XXXXXX at the end will be replaced with a random generated string, ensuring uniqueness
+ */
+ explicit DownloadTask(Status status, QString target, QObject* parent = 0);
/// Get the directory that will contain the update files.
QString updateFilesDir();
diff --git a/logic/updater/GoUpdate.h b/logic/updater/GoUpdate.h
index 21976f8f..479f1eeb 100644
--- a/logic/updater/GoUpdate.h
+++ b/logic/updater/GoUpdate.h
@@ -68,7 +68,7 @@ struct Operation
{
static Operation CopyOp(QString fsource, QString fdest, int fmode=0644)
{
- return Operation{OP_COPY, fsource, fdest, fmode};
+ return Operation{OP_REPLACE, fsource, fdest, fmode};
}
static Operation DeleteOp(QString file)
{
@@ -84,7 +84,7 @@ struct Operation
//! Specifies the type of operation that this is.
enum Type
{
- OP_COPY,
+ OP_REPLACE,
OP_DELETE,
} type;