Packages: add archive-path XML support

Allow the in-archive file path to differ from the after-install path.
Requested to allow easier operation with GitHub/Labs zip generation.
This commit is contained in:
James Turner 2018-04-27 15:25:13 +01:00
parent 6db59c64aa
commit 831369f653
3 changed files with 11 additions and 3 deletions

View File

@ -593,7 +593,7 @@ void testInstallArchiveType(HTTP::Client* cl)
SGPath p(rootPath); SGPath p(rootPath);
p.append("org.flightgear.test.catalog1"); p.append("org.flightgear.test.catalog1");
p.append("Aircraft"); p.append("Aircraft");
p.append("movies_6789"); // FIXME once archive-dir support is decided p.append("movies");
SG_CHECK_EQUAL(p, ins->path()); SG_CHECK_EQUAL(p, ins->path());

View File

@ -169,7 +169,12 @@ protected:
// build a path like /path/to/packages/org.some.catalog/Aircraft/extract_xxxx/MyAircraftDir // build a path like /path/to/packages/org.some.catalog/Aircraft/extract_xxxx/MyAircraftDir
SGPath extractedPath = m_extractPath; SGPath extractedPath = m_extractPath;
if (m_owner->package()->properties()->hasChild("archive-path")) {
extractedPath.append(m_owner->package()->properties()->getStringValue("archive-path"));
} else {
extractedPath.append(m_owner->package()->dirName()); extractedPath.append(m_owner->package()->dirName());
}
// rename it to path/to/packages/org.some.catalog/Aircraft/MyAircraftDir // rename it to path/to/packages/org.some.catalog/Aircraft/MyAircraftDir
bool ok = extractedPath.rename(m_owner->path()); bool ok = extractedPath.rename(m_owner->path());
@ -179,6 +184,8 @@ protected:
} }
// extract_xxxx directory is now empty, so remove it // extract_xxxx directory is now empty, so remove it
// (note it might not be empty if the archive contained some other
// files, but we delete those in such a case
if (m_extractPath.exists()) { if (m_extractPath.exists()) {
simgear::Dir(m_extractPath).remove(); simgear::Dir(m_extractPath).remove();
} }

View File

@ -183,10 +183,11 @@
<id>movies</id> <id>movies</id>
<name>movies files for test catalog aircraft</name> <name>movies files for test catalog aircraft</name>
<revision>10</revision> <revision>10</revision>
<dir>movies_6789</dir> <dir>movies</dir>
<!-- url has no file extension, instead we set arcive-type --> <!-- url has no file extension, instead we set arcive-type -->
<url>http://localhost:2000/catalogTest1/movies?wierd=foo;bar=thing</url> <url>http://localhost:2000/catalogTest1/movies?wierd=foo;bar=thing</url>
<archive-type>zip</archive-type> <archive-type>zip</archive-type>
<archive-path>movies_6789</archive-path>
<file-size-bytes>232</file-size-bytes> <file-size-bytes>232</file-size-bytes>
<md5>e5f89c3f1ed1bdda16174c868f3c7b30</md5> <md5>e5f89c3f1ed1bdda16174c868f3c7b30</md5>
</package> </package>