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

FsPath Class Reference


Detailed Description

File system path.

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").


Member Function Documentation

void FsPath::createPath const std::string &  file  )  [static]
 

Create all directories in path (like "mkdir -p").

Parameters:
file posix filename

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 }

bool FsPath::exists const std::string &  file  )  [static]
 

Returns true when file or directory exists.

Parameters:
file posix filename

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 }

std::string FsPath::getNative const std::string &  file  )  [static]
 

Get native filename.

Parameters:
file posix filename

Definition at line 26 of file FsPath.cpp.

00027 {
00028     return file;
00029 }

std::string FsPath::join const std::string &  dir,
const std::string &  file
[static]
 

Joint two paths.

Parameters:
dir posix filename
file posix filename
Returns:
"dir/file"

Definition at line 54 of file FsPath.cpp.

00055 {
00056     if (dir.empty()) {
00057         return file;
00058     }
00059 
00060     return dir + '/' + file;
00061 }


The documentation for this class was generated from the following files:
Generated on Wed Jun 1 09:55:09 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2