From 17dca254a3f451ffb1494375bbb3e67bc699d191 Mon Sep 17 00:00:00 2001 From: Denis Krjuchkov Date: Sat, 2 Feb 2013 19:28:02 +0600 Subject: [PATCH] Path.hxx: add GetDirectoryName() method --- src/fs/Path.hxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/fs/Path.hxx b/src/fs/Path.hxx index 8635d12a9..eaab2bde5 100644 --- a/src/fs/Path.hxx +++ b/src/fs/Path.hxx @@ -253,6 +253,15 @@ public: std::string ToUTF8() const { return ToUTF8(value); } + + /** + * Gets directory name of this path. + * Returns a "nulled" instance on error. + */ + Path GetDirectoryName() const { + assert(value != nullptr); + return Path(Donate(), g_path_get_dirname(value)); + } }; #endif