Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

FsPath.cpp File Reference

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.


Function Documentation

void createDir const std::string &  dir  )  [inline]
 

Create dir.

Parameters:
dir posix filename
Exceptions:
NameException when error occurs

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 }

std::string dirPath const std::string &  file  )  [inline]
 

Return path without file basename.

Parameters:
file posix filename

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 }


Generated on Wed Jun 1 09:54:32 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2