24 #ifndef _BASIS_OS_PATH_H 25 #define _BASIS_OS_PATH_H 37 namespace basis {
namespace os {
namespace path {
69 std::string
normpath(
const std::string& path);
84 std::string
posixpath(
const std::string& path);
99 std::string
ntpath(
const std::string& path);
137 void split(
const std::string& path, std::string& head, std::string& tail);
146 std::vector<std::string>
split(
const std::string& path);
156 void splitdrive(
const std::string& path, std::string& drive, std::string& tail);
165 std::vector<std::string>
splitdrive(
const std::string& path);
183 void splitext(
const std::string& path, std::string& head, std::string& ext,
184 const std::set<std::string>* exts = NULL,
bool icase =
false);
194 std::vector<std::string>
splitext(
const std::string& path,
const std::set<std::string>* exts = NULL);
205 std::string
dirname(
const std::string& path);
216 std::string
basename(
const std::string& path);
229 bool hasext(
const std::string& path,
const std::set<std::string>* exts = NULL);
242 bool isabs(
const std::string& path);
253 std::string
abspath(
const std::string& path);
269 std::string
relpath(
const std::string& path,
const std::string& base = std::string());
280 std::string
realpath(
const std::string& path);
295 std::string
join(
const std::string& base,
const std::string& path);
308 bool exists(
const std::string path);
319 bool isfile(
const std::string path);
330 bool isdir(
const std::string path);
343 bool islink(
const std::string& path);
356 #endif // _BASIS_OS_PATH_H std::string ntpath(const std::string &path)
Convert path to Windows representation.
std::string normpath(const std::string &path)
Normalize path, i.e., remove occurences of "./", duplicate slashes,...
std::string realpath(const std::string &path)
Get canonical file path.
std::string join(const std::string &base, const std::string &path)
Join two paths, e.g., base path and relative path.
bool hasext(const std::string &path, const std::set< std::string > *exts=NULL)
Test whether a given path has an extension.
bool isabs(const std::string &path)
Test whether a given path is absolute.
void splitdrive(const std::string &path, std::string &drive, std::string &tail)
Get drive specification of Windows path.
bool issep(char c)
Determine if a given character is a path separator.
bool exists(const std::string path)
Test the existance of a file or directory.
bool isfile(const std::string path)
Test whether a given path is the path of an existent file.
std::string basename(const std::string &path)
Get file name.
std::string abspath(const std::string &path)
Make path absolute.
void split(const std::string &path, std::string &head, std::string &tail)
Split path into two parts.
std::string relpath(const std::string &path, const std::string &base=std::string())
Make path relative.
bool islink(const std::string &path)
Whether a given path is a symbolic link.
void splitext(const std::string &path, std::string &head, std::string &ext, const std::set< std::string > *exts=NULL, bool icase=false)
Get file name extension.
std::string dirname(const std::string &path)
Get file directory.
bool isdir(const std::string path)
Test whether a given path is the path of an existent directory.
std::string posixpath(const std::string &path)
Convert path to Posix (e.g., Unix, Mac OS) representation.