Package::existingInstall helper.
This commit is contained in:
parent
adebbe006b
commit
a8c8148068
@ -97,19 +97,21 @@ bool Package::matches(const SGPropertyNode* aFilter) const
|
||||
|
||||
bool Package::isInstalled() const
|
||||
{
|
||||
SGPath p(m_catalog->installRoot());
|
||||
p.append("Aircraft");
|
||||
p.append(id());
|
||||
|
||||
// anything to check for? look for a valid revision file?
|
||||
return p.exists();
|
||||
return pathOnDisk().exists();
|
||||
}
|
||||
|
||||
InstallRef Package::install()
|
||||
SGPath Package::pathOnDisk() const
|
||||
{
|
||||
SGPath p(m_catalog->installRoot());
|
||||
p.append("Aircraft");
|
||||
p.append(id());
|
||||
return p;
|
||||
}
|
||||
|
||||
InstallRef Package::install()
|
||||
{
|
||||
SGPath p(pathOnDisk());
|
||||
if (p.exists()) {
|
||||
return Install::createFromPath(p, m_catalog);
|
||||
}
|
||||
@ -119,6 +121,16 @@ InstallRef Package::install()
|
||||
return ins;
|
||||
}
|
||||
|
||||
InstallRef Package::existingInstall() const
|
||||
{
|
||||
SGPath p(pathOnDisk());
|
||||
if (p.exists()) {
|
||||
return Install::createFromPath(p, m_catalog);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::string Package::id() const
|
||||
{
|
||||
return m_props->getStringValue("id");
|
||||
|
@ -53,7 +53,9 @@ public:
|
||||
* get or create an install for the package
|
||||
*/
|
||||
InstallRef install();
|
||||
|
||||
|
||||
InstallRef existingInstall() const;
|
||||
|
||||
bool isInstalled() const;
|
||||
|
||||
std::string id() const;
|
||||
@ -102,6 +104,8 @@ public:
|
||||
*/
|
||||
PackageList dependencies() const;
|
||||
private:
|
||||
SGPath pathOnDisk() const;
|
||||
|
||||
friend class Catalog;
|
||||
|
||||
Package(const SGPropertyNode* aProps, CatalogRef aCatalog);
|
||||
|
Loading…
Reference in New Issue
Block a user