More SGPath APIs
This commit is contained in:
parent
b862cf7e54
commit
32735428bb
@ -374,6 +374,11 @@ string SGPath::dir() const {
|
||||
}
|
||||
}
|
||||
|
||||
SGPath SGPath::dirPath() const
|
||||
{
|
||||
return SGPath::fromUtf8(dir());
|
||||
}
|
||||
|
||||
// get the base part of the path (everything but the extension.)
|
||||
string SGPath::base() const
|
||||
{
|
||||
@ -871,6 +876,20 @@ std::vector<SGPath> SGPath::pathsFromEnv(const char *name)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
std::vector<SGPath> SGPath::pathsFromUtf8(const std::string& paths)
|
||||
{
|
||||
std::vector<SGPath> r;
|
||||
string_list items = sgPathSplit(paths);
|
||||
string_list_iterator it;
|
||||
for (it = items.begin(); it != items.end(); ++it) {
|
||||
r.push_back(SGPath::fromUtf8(it->c_str()));
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
std::vector<SGPath> SGPath::pathsFromLocal8Bit(const std::string& paths)
|
||||
{
|
||||
std::vector<SGPath> r;
|
||||
|
@ -268,6 +268,12 @@ public:
|
||||
* or if the destination already exists, or is not writeable
|
||||
*/
|
||||
bool rename(const SGPath& newName);
|
||||
|
||||
|
||||
/**
|
||||
* return the path of the parent directory of this path.
|
||||
*/
|
||||
SGPath dirPath() const;
|
||||
|
||||
enum StandardLocation
|
||||
{
|
||||
@ -311,6 +317,8 @@ public:
|
||||
|
||||
static std::vector<SGPath> pathsFromEnv(const char* name);
|
||||
|
||||
static std::vector<SGPath> pathsFromUtf8(const std::string& paths);
|
||||
|
||||
static std::vector<SGPath> pathsFromLocal8Bit(const std::string& paths);
|
||||
|
||||
static std::string join(const std::vector<SGPath>& paths, const std::string& joinWith);
|
||||
|
Loading…
Reference in New Issue
Block a user