From 613c01dab5222a99fa642a466ce37ade53f1c072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 5 Jan 2014 13:17:42 +0100 Subject: Some more updater fixes Paths were wrong - still used work directory instead of root --- mmc_updater/src/UpdateInstaller.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'mmc_updater/src/UpdateInstaller.cpp') 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::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); -- cgit v1.2.3