|
charon-core
0.3.1
|
Useful functions when working with files. More...
Functions | |
| int charon_core_DLL_PUBLIC | changeDir (const std::string &dir) |
| Change current working directory. More... | |
| bool charon_core_DLL_PUBLIC | exists (const std::string &file) |
| Check if file exists. More... | |
| std::string charon_core_DLL_PUBLIC | getCurrentDir () |
| Get current working directory. More... | |
| std::vector< std::string > charon_core_DLL_PUBLIC | getFilesWithSuffix (std::string suffix) |
| Search files with given suffix. More... | |
| int charon_core_DLL_PUBLIC | makeDir (const std::string &dir) |
| Create a new directory using MODE 711 (in unix) More... | |
| int charon_core_DLL_PUBLIC | makePath (std::string &path) |
| This function creates all directories contained in path provided they do not already exist. More... | |
| std::string charon_core_DLL_PUBLIC | readFile (const std::string &fName) |
| read file content into std::string More... | |
| int charon_core_DLL_PUBLIC | remove (const std::string &file) |
| Remove file. More... | |
| int charon_core_DLL_PUBLIC | rename (const std::string &oldFile, const std::string &newFile) |
| Rename file. More... | |
| void charon_core_DLL_PUBLIC | slashConvert (std::string &src) |
| Convert unix to windows paths and reversed. More... | |
Variables | |
| const char charon_core_DLL_PUBLIC | slash = '\\' |
| Slash of current operating system ("/" or "\") | |
This wraps the operating system specific functions.
| int FileTool::changeDir | ( | const std::string & | dir | ) |
| dir | new working directory |
Definition at line 91 of file FileTool.cpp.
| bool FileTool::exists | ( | const std::string & | file | ) |
| file | name of the file to look for |
Definition at line 154 of file FileTool.cpp.
| std::string FileTool::getCurrentDir | ( | ) |
Definition at line 95 of file FileTool.cpp.
| std::vector< std::string > FileTool::getFilesWithSuffix | ( | std::string | suffix | ) |
Iterates through the files of the current working directory and looks for files with the given suffix.
| suffix | Suffix of the requested files |
Definition at line 104 of file FileTool.cpp.
| int FileTool::makeDir | ( | const std::string & | dir | ) |
| dir | name of the directory to create |
Definition at line 87 of file FileTool.cpp.
| int FileTool::makePath | ( | std::string & | path | ) |
| path | path to create |
Definition at line 71 of file FileTool.cpp.
References StringTool::explode(), makeDir(), slash, and slashConvert().
| std::string FileTool::readFile | ( | const std::string & | fName | ) |
Reads a file and writes it into a std::string.
| fName | File to read |
Definition at line 167 of file FileTool.cpp.
| int FileTool::remove | ( | const std::string & | file | ) |
| file | name of the file to remove |
Definition at line 159 of file FileTool.cpp.
| int FileTool::rename | ( | const std::string & | oldFile, |
| const std::string & | newFile | ||
| ) |
| oldFile | name of the file to rename |
| newFile | new name |
Definition at line 163 of file FileTool.cpp.
| void FileTool::slashConvert | ( | std::string & | src | ) |
The direction is determined by the current running operating system.
| src | source string to convert (will be modified) |
Definition at line 145 of file FileTool.cpp.
References slash.