diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-06-08 02:43:16 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-06-09 00:03:42 +0200 |
commit | 82e05661d207621f917d79ebd513abc57a36c084 (patch) | |
tree | b13eb12af54ff1a6214d9b0c7b34ce6a9e5aa975 /logic/updater/GoUpdate.cpp | |
parent | 166813cb918ebd029325e12377989bfdc2021074 (diff) | |
download | MultiMC-82e05661d207621f917d79ebd513abc57a36c084.tar MultiMC-82e05661d207621f917d79ebd513abc57a36c084.tar.gz MultiMC-82e05661d207621f917d79ebd513abc57a36c084.tar.lz MultiMC-82e05661d207621f917d79ebd513abc57a36c084.tar.xz MultiMC-82e05661d207621f917d79ebd513abc57a36c084.zip |
GH-1060 implement very basic updater (only linux and maybe osx right now)
Diffstat (limited to 'logic/updater/GoUpdate.cpp')
-rw-r--r-- | logic/updater/GoUpdate.cpp | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/logic/updater/GoUpdate.cpp b/logic/updater/GoUpdate.cpp index d85f00d6..a43c5e7c 100644 --- a/logic/updater/GoUpdate.cpp +++ b/logic/updater/GoUpdate.cpp @@ -213,78 +213,4 @@ bool fixPathForOSX(QString &path) return false; } } - -bool writeInstallScript(OperationList &opsList, QString scriptFile) -{ - // Build the base structure of the XML document. - QDomDocument doc; - - QDomElement root = doc.createElement("update"); - root.setAttribute("version", "3"); - doc.appendChild(root); - - QDomElement installFiles = doc.createElement("install"); - root.appendChild(installFiles); - - QDomElement removeFiles = doc.createElement("uninstall"); - root.appendChild(removeFiles); - - // Write the operation list to the XML document. - for (Operation op : opsList) - { - QDomElement file = doc.createElement("file"); - - switch (op.type) - { - case Operation::OP_COPY: - { - // Install the file. - QDomElement name = doc.createElement("source"); - QDomElement path = doc.createElement("dest"); - QDomElement mode = doc.createElement("mode"); - name.appendChild(doc.createTextNode(op.file)); - path.appendChild(doc.createTextNode(op.dest)); - // We need to add a 0 at the beginning here, because Qt doesn't convert to octal - // correctly. - mode.appendChild(doc.createTextNode("0" + QString::number(op.mode, 8))); - file.appendChild(name); - file.appendChild(path); - file.appendChild(mode); - installFiles.appendChild(file); - qDebug() << "Will install file " << op.file << " to " << op.dest; - } - break; - - case Operation::OP_DELETE: - { - // Delete the file. - file.appendChild(doc.createTextNode(op.file)); - removeFiles.appendChild(file); - qDebug() << "Will remove file" << op.file; - } - break; - - default: - qWarning() << "Can't write update operation of type" << op.type - << "to file. Not implemented."; - continue; - } - } - - // Write the XML document to the file. - QFile outFile(scriptFile); - - if (outFile.open(QIODevice::WriteOnly)) - { - outFile.write(doc.toByteArray()); - } - else - { - return false; - } - - return true; -} - - }
\ No newline at end of file |