More SGPath APIs
This commit is contained in:
@@ -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.)
|
// get the base part of the path (everything but the extension.)
|
||||||
string SGPath::base() const
|
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> SGPath::pathsFromLocal8Bit(const std::string& paths)
|
||||||
{
|
{
|
||||||
std::vector<SGPath> r;
|
std::vector<SGPath> r;
|
||||||
|
|||||||
@@ -269,6 +269,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool rename(const SGPath& newName);
|
bool rename(const SGPath& newName);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return the path of the parent directory of this path.
|
||||||
|
*/
|
||||||
|
SGPath dirPath() const;
|
||||||
|
|
||||||
enum StandardLocation
|
enum StandardLocation
|
||||||
{
|
{
|
||||||
HOME,
|
HOME,
|
||||||
@@ -311,6 +317,8 @@ public:
|
|||||||
|
|
||||||
static std::vector<SGPath> pathsFromEnv(const char* name);
|
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::vector<SGPath> pathsFromLocal8Bit(const std::string& paths);
|
||||||
|
|
||||||
static std::string join(const std::vector<SGPath>& paths, const std::string& joinWith);
|
static std::string join(const std::vector<SGPath>& paths, const std::string& joinWith);
|
||||||
|
|||||||
Reference in New Issue
Block a user