Avoid checking for existence of package when installing symlinks

Only check for the existence of the package for regular files
This commit is contained in:
Robert Knight 2011-08-21 23:31:54 +01:00
parent be8d6cbc87
commit dc303201fa
2 changed files with 12 additions and 6 deletions

View file

@ -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());

View file

@ -23,6 +23,11 @@
<permissions>30549</permissions>
<package>app-pkg</package>
</file>
<!-- Test symlink !-->
<file>
<name>test-dir/app-symlink</name>
<target>../app</target>
</file>
</install>
<uninstall>
<!-- TODO - List some files to uninstall here !-->