System dependent operations.
Definition at line 10 of file FsPath.h.
Static Public Member Functions | |
| static std::string | getNative (const std::string &file) |
| Get native filename. | |
| static bool | exists (const std::string &file) |
| Returns true when file or directory exists. | |
| static std::string | join (const std::string &dir, const std::string &file) |
| Joint two paths. | |
| static void | createPath (const std::string &dir) |
| Create all directories in path (like "mkdir -p"). | |
|
|
Create all directories in path (like "mkdir -p").
Definition at line 113 of file FsPath.cpp. 00114 {
00115 std::string parent = dirPath(file);
00116 if (!FsPath::exists(parent)) {
00117 createPath(parent);
00118 createDir(parent);
00119 }
00120 }
|
|
|
Returns true when file or directory exists.
Definition at line 36 of file FsPath.cpp. 00037 {
00038 if (file.empty()) {
00039 return true;
00040 }
00041
00042 struct stat buf;
00043 int error = stat(file.c_str(), &buf);
00044 return !error;
00045 }
|
|
|
Get native filename.
Definition at line 26 of file FsPath.cpp. 00027 {
00028 return file;
00029 }
|
|
||||||||||||
|
Joint two paths.
Definition at line 54 of file FsPath.cpp. 00055 {
00056 if (dir.empty()) {
00057 return file;
00058 }
00059
00060 return dir + '/' + file;
00061 }
|
1.4.2