mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-07 01:22:05 +00:00
Refactored add-on VCS tree...
...and .pbl checks into separate functions for reusing later
This commit is contained in:
parent
27cb67da57
commit
0115db3e23
@ -53,6 +53,23 @@ static lg::log_domain log_network("network");
|
||||
#define ERR_NET LOG_STREAM(err , log_network)
|
||||
#define LOG_NET LOG_STREAM(info, log_network)
|
||||
|
||||
bool have_addon_in_vcs_tree(const std::string& addon_name)
|
||||
{
|
||||
static const std::string parentd = get_addon_campaigns_dir();
|
||||
return
|
||||
file_exists(parentd+"/"+addon_name+"/.svn") ||
|
||||
file_exists(parentd+"/"+addon_name+"/.git") ||
|
||||
file_exists(parentd+"/"+addon_name+"/.hg");
|
||||
}
|
||||
|
||||
bool have_addon_pbl_info(const std::string& addon_name)
|
||||
{
|
||||
static const std::string parentd = get_addon_campaigns_dir();
|
||||
return
|
||||
file_exists(parentd+"/"+addon_name+".pbl") ||
|
||||
file_exists(parentd+"/"+addon_name+"/_server.pbl");
|
||||
}
|
||||
|
||||
bool get_addon_info(const std::string& addon_name, config& cfg)
|
||||
{
|
||||
const std::string parentd = get_addon_campaigns_dir();
|
||||
@ -1523,12 +1540,8 @@ void refresh_addon_version_info_cache()
|
||||
version_info_cache.insert(std::make_pair(addon, version_info(version)));
|
||||
}
|
||||
// Don't print the warning if the user is clearly the author
|
||||
else if (!file_exists(parentd+"/"+addon+".pbl")
|
||||
&& !file_exists(parentd+"/"+addon+"/_server.pbl")
|
||||
&& !file_exists(parentd+"/"+addon+"/.svn")
|
||||
&& !file_exists(parentd+"/"+addon+"/.git")
|
||||
&& !file_exists(parentd+"/"+addon+"/.hg")) {
|
||||
WRN_CFG << "add-on '" << addon << "' has no _info.cfg; cannot read version info\n";
|
||||
else if (!have_addon_pbl_info(addon) && !have_addon_in_vcs_tree(addon)) {
|
||||
WRN_CFG << "add-on '" << addon << "' has no _info.cfg; cannot read version info\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,18 @@ class config_changed_exception {};
|
||||
|
||||
bool remove_local_addon(const std::string& addon);
|
||||
|
||||
/**
|
||||
* Returns true if there's a local .pbl file stored for the specified add-on.
|
||||
*/
|
||||
bool have_addon_pbl_info(const std::string& addon_name);
|
||||
|
||||
/**
|
||||
* Returns true if the specified add-ons appear to be managed by a 'supported' VCS.
|
||||
*
|
||||
* Currently supported VCSes are: Subversion, Git, Mercurial.
|
||||
*/
|
||||
bool have_addon_in_vcs_tree(const std::string& addon_name);
|
||||
|
||||
/**
|
||||
* Gets the publish information for an add-on.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user