summaryrefslogtreecommitdiff
path: root/src/syncevo/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/syncevo/util.h')
-rw-r--r--src/syncevo/util.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/syncevo/util.h b/src/syncevo/util.h
index 2302f60b..b7a1b5e8 100644
--- a/src/syncevo/util.h
+++ b/src/syncevo/util.h
@@ -65,6 +65,23 @@ typedef map<string, string> StringMap;
string normalizePath(const string &path);
/**
+ * Returns last component of path. Trailing slash is ignored.
+ * Empty if path is empty.
+ */
+string getBasename(const string &path);
+
+/**
+ * Returns path without the last component. Empty if nothing left.
+ */
+string getDirname(const string &path);
+
+/**
+ * Splits path into directory and file part. Trailing slashes
+ * are stripped first.
+ */
+void splitPath(const string &path, string &dir, string &file);
+
+/**
* convert relative path to canonicalized absolute path
* @param path will be turned into absolute path if possible, otherwise left unchanged
* @return true if conversion is successful, false otherwise(errno will be set)