27 std::string str = istr;
30 std::string::size_type bslashpos;
31 while ( std::string::npos != ( bslashpos = str.find(
'\\' ) ) )
33 str.replace( bslashpos, 1, 1,
'/' );
37 if ( str.size() == 0 )
41 else if ( str[str.size() - 1] ==
'/' || str[str.size() - 1] ==
'\\' )
53 std::string sdir( dir );
54 if ( sdir[sdir.length() - 1] ==
'/' )
55 sdir = sdir.erase( sdir.length() - 1, 1 );
57 if ( stat( sdir.c_str(), &st ) )
59 return ( st.st_mode & S_IFDIR ?
true :
false );
73 std::string::size_type pos = direc.find_last_of(
"\\/" );
74 if ( pos == std::string::npos )
76 if ( pos >= 1 && direc[pos - 1] ==
':' )
78 direc = direc.substr( 0, pos );
84 if ( access( dir, 0 ) )
87 if ( CreateDirectory( dir, NULL ) )
89 if ( mkdir( dir, 0777 ) == 0 )
97 std::string parent_dir = dir;
100 if (
make_dir( parent_dir.c_str() ) )
103 if ( CreateDirectory( dir, NULL ) )
106 if ( mkdir( dir, 0777 ) == 0 )
110 if ( access( dir, 0 ) == 0 )
120 return ( access( filename, 0 ) == 0 );
124 return ( access( filename.c_str(), 0 ) == 0 );
130 if ( stat( fname, &st ) )
138 if ( stat( fname, &st ) )
140 return (
unsigned int)st.st_mtime;
145 unlink( fname.c_str() );
152 if ( realpath( filename, tmp ) )
158 _fullpath( p, filename,
sizeof p );
177 std::string fn( filename );
178 std::string::size_type lastslash = fn.find_last_of(
"\\/" );
179 if ( lastslash == std::string::npos )
182 return fn.substr( lastslash + 1 );
std::string FullPath(const char *filename)
void MakeDirectory(const char *dir)
int strip_one(std::string &direc)
unsigned int GetFileTimestamp(const char *fname)
std::string GetFilePart(const char *filename)
void open(const char *filespec)
bool IsDirectory(const char *dir)
int filesize(const char *fname)
std::string GetTrueName(const char *filename)
void RemoveFile(const std::string &fname)
std::string normalized_dir_form(const std::string &istr)
bool FileExists(const char *filename)
int make_dir(const char *dir)