diff --git a/src/UpdateInstaller.cpp b/src/UpdateInstaller.cpp index abd0ac7..e42f554 100644 --- a/src/UpdateInstaller.cpp +++ b/src/UpdateInstaller.cpp @@ -172,15 +172,9 @@ void UpdateInstaller::revert() void UpdateInstaller::installFile(const UpdateScriptFile& file) { - std::string packageFile = m_packageDir + '/' + file.package + ".zip"; std::string destPath = m_installDir + '/' + file.path; std::string target = file.linkTarget; - if (!FileOps::fileExists(packageFile.c_str())) - { - throw "Package file does not exist: " + packageFile; - } - // backup the existing file if any backupFile(destPath); @@ -193,6 +187,13 @@ void UpdateInstaller::installFile(const UpdateScriptFile& file) if (target.empty()) { + // locate the package containing the file + std::string packageFile = m_packageDir + '/' + file.package + ".zip"; + if (!FileOps::fileExists(packageFile.c_str())) + { + throw "Package file does not exist: " + packageFile; + } + // extract the file from the package and copy it to // the destination FileOps::extractFromZip(packageFile.c_str(),file.path.c_str(),destPath.c_str()); diff --git a/src/tests/file_list.xml b/src/tests/file_list.xml index 2b97ce5..ef8391a 100644 --- a/src/tests/file_list.xml +++ b/src/tests/file_list.xml @@ -23,6 +23,11 @@ 30549 app-pkg + + + test-dir/app-symlink + ../app +