Classes | |
| class | DirectoryListing |
Functions | |
| String | normalizePath (const String &inFileName) |
| String | getFullPathName (const String &inFileName) |
| String | getFileNameFromPath (const String &inPathName) |
| String | getExtension (const String &inPathName) |
| String | removeFileNameFromPath (const String &inPathName) |
| String | removeExtensionFromPath (const String &inPathName) |
| String | removeTrailingPathSeparator (const String &inPathName) |
| String | createTempFileName (const String &inFileName) |
| bool | doesExist (const String &inFileName) |
| bool | isDirectory (const String &inPath) |
| bool | deleteFile (const String &inFileName) |
| bool | copyFile (const String &inSrc, const String &inDest, bool forceOverwrite=false) |
| bool | replaceFile (const String &inReplacee, const String &inReplacer) |
| void | setTemporaryAttributes (const String &inFileName, bool inTemporary=true) |
| String | getCurrentDirectory () |
| String | getTemporaryDirectory () |
| bool | isAbsolutePath (const String &inFileName) |
| bool Celartem::FileUtils::copyFile | ( | const String & | inSrc, | |
| const String & | inDest, | |||
| bool | forceOverwrite = false | |||
| ) |
This function duplicates the specified file.
| inSrc | File name that specifies the file to be copied. | |
| inDest | Destination file name. | |
| forceOverwrite | if the parameter is true, then this function overwrites the existing file, otherwise the function fails. |
true if success, otherwise false. Referenced by Celartem::Path::overwriteWith().
| String Celartem::FileUtils::createTempFileName | ( | const String & | inFileName | ) |
This function creates a temporary name that is based on the input filename. This function also creates the file to preserve the temporary name.
For example, if you pass "/foo/bar/baz", then it returns "/foo/bar/baz.xxx" or something like it.
| inFileName | A base file name. |
| bool Celartem::FileUtils::deleteFile | ( | const String & | inFileName | ) |
This function delete the specified file.
| inFileName | A file to be deleted. |
true if success, otherwise false. Referenced by Celartem::Path::deleteFile().
| bool Celartem::FileUtils::doesExist | ( | const String & | inFileName | ) |
This function checks whether the specified file exists or not.
| inFileName | A file to check the existence. |
true if the file exists, otherwise false. Referenced by Celartem::Path::doesExist().
| String Celartem::FileUtils::getCurrentDirectory | ( | ) |
This function returns the path for the current working directory.
| String Celartem::FileUtils::getExtension | ( | const String & | inPathName | ) |
This function returns the extension ".XXX" from the specified path.
| inPathName | Any path name for a file. |
Referenced by Celartem::Path::getExtension().
| String Celartem::FileUtils::getFileNameFromPath | ( | const String & | inPathName | ) |
This function returns the body file name from the specified path.
| inPathName | Any path name for a file. |
Referenced by Celartem::Path::getBodyFileName().
| String Celartem::FileUtils::getFullPathName | ( | const String & | inFileName | ) |
This function converts the partial path name (relative path) into full path name.
| inFileName | Any relative path name of the file. |
| String Celartem::FileUtils::getTemporaryDirectory | ( | ) |
This function returns the path for the temporary directory.
| bool Celartem::FileUtils::isAbsolutePath | ( | const String & | inFileName | ) |
This function determines whether the specified file name is an absolute path by syntax checking.
Please note that it does not check the existance of the file.
| inFileName | A file name. |
true if it is an absolute file name; otherwise false. | bool Celartem::FileUtils::isDirectory | ( | const String & | inPath | ) |
This function checks whether the specified path is a directory or not.
| inPath | A path to check. |
true if the path is a directory, otherwise false. Referenced by Celartem::Path::isDirectory().
| String Celartem::FileUtils::normalizePath | ( | const String & | inFileName | ) |
This function returns the normalized path of the specified file path. A normalized path meets the following conditions:
../ or ./ ./ or \ is removed.In Windows, the normalization process also does:
/ characters in the path are replaced with \ .
| inPathName | Any path name for a file. |
bool isInHomeDir(const String& inFileName) { String home = FileUtils::normalizePath(getHomeDir()); String path = FileUtils::normalizePath(inFileName); // since the file path is normalized, if a file is within the // user's home directory, its path should be started from // \c /home/XXX/ . if(path.findPos(home) == 0) return true; return false; }
Referenced by Celartem::Path::assign().
| String Celartem::FileUtils::removeExtensionFromPath | ( | const String & | inPathName | ) |
This function removes the extension (including '.') from the specified path if exists.
| inPathName | Any path name for a file. |
Referenced by Celartem::Path::removeExtension().
| String Celartem::FileUtils::removeFileNameFromPath | ( | const String & | inPathName | ) |
This function removes the body file name from the specified path. If you pass "C:\foo\bar\baz" for the function, it returns "C:\foo\bar\" and never removes the last '\' from the path. On Windows, this function also works with '/' path separator.
| inPathName | Any path name for a file. |
Referenced by Celartem::Path::removeFileNameFromPath().
| String Celartem::FileUtils::removeTrailingPathSeparator | ( | const String & | inPathName | ) |
This function removes the traling path separator from the specified path. If you pass "C:\foo\bar\baz\" for the function, it returns "C:\foo\bar\baz". On Windows, this function also works with '/' path separator.
| inPathName | Any path name for a file. |
Referenced by Celartem::Path::removeTrailingPathSeparator().
| bool Celartem::FileUtils::replaceFile | ( | const String & | inReplacee, | |
| const String & | inReplacer | |||
| ) |
This function replaces one file with another.
| inReplacee | File name that specifies the file to be replaced. | |
| inReplacer | File name that specifies the file that overwrites the file. |
true if success, otherwise false. Referenced by Celartem::Path::replaceWith().
| void Celartem::FileUtils::setTemporaryAttributes | ( | const String & | inFileName, | |
| bool | inTemporary = true | |||
| ) |
This function optimizes the file for temporary use.
| inFileName | The file to be used as a temporary file. | |
| inTemporary | true to use as a temporary file. |