Go to the source code of this file.
Functions | |
std::string | dirPath (const std::string &file) |
Return path without file basename. | |
void | createDir (const std::string &dir) |
Create dir. |
|
Create dir.
Definition at line 90 of file FsPath.cpp. 00091 { 00092 if (dir.empty()) { 00093 return; 00094 } 00095 00096 #ifdef WIN32 00097 int error = mkdir(dir.c_str()); 00098 #else 00099 int error = mkdir(dir.c_str(), 0777); 00100 #endif 00101 if (error) { 00102 throw PathException(ExInfo("cannot create dir") 00103 .addInfo("stderror", strerror(errno)) 00104 .addInfo("dir", dir)); 00105 } 00106 }
|
|
Return path without file basename.
Definition at line 69 of file FsPath.cpp. 00070 { 00071 std::string dirs = ""; 00072 std::string::size_type pos = file.rfind('/'); 00073 if (pos == 0) { 00074 //NOTE: root 00075 dirs = "/"; 00076 } 00077 else if (pos != std::string::npos) { 00078 dirs = file.substr(0, pos); 00079 } 00080 00081 return dirs; 00082 }
|