summaryrefslogtreecommitdiffstats
path: root/raul
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-02-19 04:59:55 +0000
committerDavid Robillard <d@drobilla.net>2011-02-19 04:59:55 +0000
commit62b0623bd7e56d6399dc32ddaeb1c63b8f6e4737 (patch)
tree0a571aa573ab1b0a371eb8104e88d5aedc8c513e /raul
parent07f79be87d8163e58a61ce81d951d43912601494 (diff)
downloadraul-62b0623bd7e56d6399dc32ddaeb1c63b8f6e4737.tar.gz
raul-62b0623bd7e56d6399dc32ddaeb1c63b8f6e4737.tar.bz2
raul-62b0623bd7e56d6399dc32ddaeb1c63b8f6e4737.zip
Fix Path::relative_to_base.
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@2992 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'raul')
-rw-r--r--raul/Path.hpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/raul/Path.hpp b/raul/Path.hpp
index e59da60..c399767 100644
--- a/raul/Path.hpp
+++ b/raul/Path.hpp
@@ -113,7 +113,9 @@ public:
static std::string pathify(const std::basic_string<char>& str);
static std::string nameify(const std::basic_string<char>& str);
- static void replace_invalid_chars(std::string& str, size_t start, bool replace_slash = false);
+ static void replace_invalid_chars(std::string& str,
+ size_t start,
+ bool replace_slash = false);
bool is_root() const { return (*this) == root(); }
@@ -164,26 +166,23 @@ public:
}
}
-
/** Return the path's child with the given name (symbol)
*/
inline Path child(const Raul::Symbol& symbol) const {
return base() + symbol.c_str();
}
-
/** Return path relative to some base path (chop prefix)
*/
inline Path relative_to_base(const Path& base) const {
if ((*this) == base) {
return "/";
} else {
- assert(length() > base.length());
- return substr(base.length() - 1);
+ assert(length() > base.base().length());
+ return substr(base.base().length() - 1);
}
}
-
/** Return path with a trailing "/".
*
* Returned value is guaranteed to be a valid parent path, i.e. a valid
@@ -206,7 +205,6 @@ public:
return base().substr(find(":") + 1);
}
-
/** Return true if \a child is equal to, or a descendant of \a parent */
static bool descendant_comparator(const Path& parent, const Path& child) {
return ( child == parent || (child.length() > parent.length() &&