Allow defining monitordirs variable: subset/dir of topdirs which will get monitored for updates
This commit is contained in:
@@ -353,6 +353,29 @@ bool path_isroot(const string& path)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool path_isdesc(const string& _top, const string& _sub)
|
||||
{
|
||||
string top = path_canon(_top);
|
||||
string sub = path_canon(_sub);
|
||||
path_catslash(top);
|
||||
path_catslash(sub);
|
||||
for (;;) {
|
||||
if (sub == top) {
|
||||
return true;
|
||||
}
|
||||
string::size_type l = sub.size();
|
||||
sub = path_getfather(sub);
|
||||
if (sub.size() == l || sub.size() < top.size()) {
|
||||
// At root or sub shorter than top: done
|
||||
if (sub == top) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool path_isabsolute(const string& path)
|
||||
{
|
||||
if (!path.empty() && (path[0] == '/'
|
||||
|
||||
@@ -113,6 +113,10 @@ extern bool path_isabsolute(const std::string& s);
|
||||
/// Test if path is root (x:/). root is defined by root/.. == root
|
||||
extern bool path_isroot(const std::string& p);
|
||||
|
||||
/// Test if sub is a subdirectory of top. This is a textual test,
|
||||
/// links not allowed
|
||||
extern bool path_isdesc(const std::string& top, const std::string& sub);
|
||||
|
||||
/// Turn absolute path into file:// url
|
||||
extern std::string path_pathtofileurl(const std::string& path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user