diff options
author | Denis Krjuchkov <denis@crazydev.net> | 2013-02-02 19:28:02 +0600 |
---|---|---|
committer | Denis Krjuchkov <denis@crazydev.net> | 2013-02-02 19:28:02 +0600 |
commit | 17dca254a3f451ffb1494375bbb3e67bc699d191 (patch) | |
tree | 0ff08108b31e3a7724d0c64c9b29956401bc7b55 /src/fs/Path.hxx | |
parent | f6b50d23872302b8e3129bd169201463d326e6fd (diff) | |
download | mpd-17dca254a3f451ffb1494375bbb3e67bc699d191.tar.gz mpd-17dca254a3f451ffb1494375bbb3e67bc699d191.tar.xz mpd-17dca254a3f451ffb1494375bbb3e67bc699d191.zip |
Path.hxx: add GetDirectoryName() method
Diffstat (limited to 'src/fs/Path.hxx')
-rw-r--r-- | src/fs/Path.hxx | 9 |
1 files changed, 9 insertions, 0 deletions
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 |