summaryrefslogtreecommitdiffstats
path: root/mmc_updater
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-01-05 13:17:42 +0100
committerPetr Mrázek <peterix@gmail.com>2014-01-05 13:17:42 +0100
commit613c01dab5222a99fa642a466ce37ade53f1c072 (patch)
tree76e7397ed67679d168a40b36035d898b406b1430 /mmc_updater
parent76f58eb42ccc2c19f6952cbae501c17c06c3671b (diff)
downloadMultiMC-613c01dab5222a99fa642a466ce37ade53f1c072.tar
MultiMC-613c01dab5222a99fa642a466ce37ade53f1c072.tar.gz
MultiMC-613c01dab5222a99fa642a466ce37ade53f1c072.tar.lz
MultiMC-613c01dab5222a99fa642a466ce37ade53f1c072.tar.xz
MultiMC-613c01dab5222a99fa642a466ce37ade53f1c072.zip
Some more updater fixes
Paths were wrong - still used work directory instead of root
Diffstat (limited to 'mmc_updater')
-rw-r--r--mmc_updater/src/UpdateInstaller.cpp14
-rw-r--r--mmc_updater/src/UpdateScript.h1
2 files changed, 7 insertions, 8 deletions
diff --git a/mmc_updater/src/UpdateInstaller.cpp b/mmc_updater/src/UpdateInstaller.cpp
index 29cda0dc..aca23ff7 100644
--- a/mmc_updater/src/UpdateInstaller.cpp
+++ b/mmc_updater/src/UpdateInstaller.cpp
@@ -271,15 +271,15 @@ void UpdateInstaller::installFile(const UpdateScriptFile& file)
{
std::string sourceFile = file.source;
std::string destPath = file.dest;
- std::string target = file.linkTarget;
+ std::string absDestPath = FileUtils::makeAbsolute(destPath.c_str(), m_installDir.c_str());
- LOG(Info,"Installing file " + sourceFile + " to " + destPath);
+ LOG(Info,"Installing file " + sourceFile + " to " + absDestPath);
// backup the existing file if any
- backupFile(destPath);
+ backupFile(absDestPath);
// create the target directory if it does not exist
- std::string destDir = FileUtils::dirname(destPath.c_str());
+ std::string destDir = FileUtils::dirname(absDestPath.c_str());
if (!FileUtils::fileExists(destDir.c_str()))
{
LOG(Info,"Destination path missing. Creating " + destDir);
@@ -295,10 +295,10 @@ void UpdateInstaller::installFile(const UpdateScriptFile& file)
}
if(!m_dryRun)
{
- FileUtils::copyFile(sourceFile.c_str(),destPath.c_str());
+ FileUtils::copyFile(sourceFile.c_str(),absDestPath.c_str());
// set the permissions on the newly extracted file
- FileUtils::chmod(destPath.c_str(),file.permissions);
+ FileUtils::chmod(absDestPath.c_str(),file.permissions);
}
}
@@ -326,7 +326,7 @@ void UpdateInstaller::uninstallFiles()
std::vector<std::string>::const_iterator iter = m_script->filesToUninstall().begin();
for (;iter != m_script->filesToUninstall().end();iter++)
{
- std::string path = m_installDir + '/' + iter->c_str();
+ std::string path = FileUtils::makeAbsolute(iter->c_str(), m_installDir.c_str());
if (FileUtils::fileExists(path.c_str()))
{
LOG(Info,"Uninstalling " + path);
diff --git a/mmc_updater/src/UpdateScript.h b/mmc_updater/src/UpdateScript.h
index 5c863ff4..f55c7236 100644
--- a/mmc_updater/src/UpdateScript.h
+++ b/mmc_updater/src/UpdateScript.h
@@ -41,7 +41,6 @@ class UpdateScriptFile
std::string source;
/// The path to copy to.
std::string dest;
- std::string linkTarget;
/** The permissions for this file, specified
* using the standard Unix mode_t values.