fs/Path: add methods GetBase() and GetDirectoryName()

This commit is contained in:
Max Kellermann
2014-12-02 06:44:57 +01:00
parent 2c1f1de33c
commit b227fddec7
4 changed files with 48 additions and 2 deletions

View File

@@ -29,6 +29,8 @@
#include <assert.h>
#include <string.h>
class AllocatedPath;
/**
* A path name in the native file system character set.
*
@@ -128,6 +130,22 @@ public:
gcc_pure
std::string ToUTF8() const;
/**
* Determine the "base" file name.
* The return value points inside this object.
*/
gcc_pure
Path GetBase() const {
return FromFS(PathTraitsFS::GetBase(value));
}
/**
* Gets directory name of this path.
* Returns a "nulled" instance on error.
*/
gcc_pure
AllocatedPath GetDirectoryName() const;
/**
* Determine the relative part of the given path to this
* object, not including the directory separator. Returns an