1
0
Fork 0

Add-ons: make Addon::getMetadataFile() a private member function

This commit is contained in:
Florent Rougon 2018-01-09 12:42:47 +01:00
parent 7c8ab6c52a
commit 4ed99dd05c
3 changed files with 8 additions and 8 deletions

View file

@ -27,6 +27,7 @@
#include <cassert> #include <cassert>
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/misc/strutils.hxx> #include <simgear/misc/strutils.hxx>
#include <simgear/nasal/cppbind/Ghost.hxx> #include <simgear/nasal/cppbind/Ghost.hxx>
@ -469,6 +470,9 @@ Addon Addon::fromAddonDir(const SGPath& addonPath)
addon.setSupportUrl(addonSupportUrl); addon.setSupportUrl(addonSupportUrl);
addon.setCodeRepositoryUrl(addonCodeRepoUrl); addon.setCodeRepositoryUrl(addonCodeRepoUrl);
SG_LOG(SG_GENERAL, SG_DEBUG,
"Loaded add-on metadata file: '" << metadataFile.utf8Str() + "'");
return addon; return addon;
} }

View file

@ -127,10 +127,6 @@ public:
SGPath getBasePath() const; SGPath getBasePath() const;
void setBasePath(const SGPath& addonBasePath); void setBasePath(const SGPath& addonBasePath);
// “Compute” a path to the metadata file from the add-on base path
static SGPath getMetadataFile(const SGPath& addonPath);
SGPath getMetadataFile() const;
// Should be valid for use with simgear::strutils::compare_versions() // Should be valid for use with simgear::strutils::compare_versions()
std::string getMinFGVersionRequired() const; std::string getMinFGVersionRequired() const;
void setMinFGVersionRequired(const std::string& minFGVersionRequired); void setMinFGVersionRequired(const std::string& minFGVersionRequired);
@ -175,6 +171,10 @@ public:
static void setupGhost(nasal::Hash& addonsModule); static void setupGhost(nasal::Hash& addonsModule);
private: private:
// “Compute” a path to the metadata file from the add-on base path
static SGPath getMetadataFile(const SGPath& addonPath);
SGPath getMetadataFile() const;
static std::tuple<string, SGPath, string> static std::tuple<string, SGPath, string>
parseLicenseNode(const SGPath& addonPath, SGPropertyNode* addonNode); parseLicenseNode(const SGPath& addonPath, SGPropertyNode* addonNode);

View file

@ -113,7 +113,6 @@ AddonManager::registerAddonMetadata(const SGPath& addonPath)
{ {
using ptr_traits = shared_ptr_traits<AddonRef>; using ptr_traits = shared_ptr_traits<AddonRef>;
AddonRef addon = ptr_traits::makeStrongRef(Addon::fromAddonDir(addonPath)); AddonRef addon = ptr_traits::makeStrongRef(Addon::fromAddonDir(addonPath));
SGPath metadataFile = addon->getMetadataFile();
string addonId = addon->getId(); string addonId = addon->getId();
SGPropertyNode* addonPropNode = fgGetNode("addons", true) SGPropertyNode* addonPropNode = fgGetNode("addons", true)
@ -151,9 +150,6 @@ AddonManager::registerAddonMetadata(const SGPath& addonPath)
"path '" + existingElt->second->getBasePath().utf8Str() + "'"); "path '" + existingElt->second->getBasePath().utf8Str() + "'");
} }
SG_LOG(SG_GENERAL, SG_DEBUG,
"Loaded add-on metadata file: '" << metadataFile.utf8Str() + "'");
return addonId; return addonId;
} }