A class for handling system files and paths using UTF-8 strings. More...
#include <FileSystem.h>
Static Public Member Functions | |
static std::string | absolutePath (const std::string &path) |
Retrives the absolute path for the given path in UTF-8. More... | |
static std::string | adjustPathToGenericForm (const std::string &filePath) |
Adjusts the given path to generic form. More... | |
static std::string | adjustPathToNativeForm (const std::string &filePath) |
Adjusts the given path to native form. More... | |
static void | copyFile (const std::string &from, const std::string &to) |
Copies a file. More... | |
static bool | createDirectories (const std::string &path) |
Creates a directory for any element of path that does not exist. More... | |
static bool | createDirectory (const std::string &path) |
Creates a directory from a given path in UTF-8. More... | |
static std::string | currentPath () |
Retrives the current working directory path in UTF-8. More... | |
static std::string | executableDirectory () |
static bool | exists (const std::string &path) |
Checks if a given path in UTF-8 exists. More... | |
static std::string | extension (const std::string &path) |
Retrives the extension of a given file path in UTF-8. More... | |
static std::string | fileName (const std::string &path) |
Retrives the filename of a given file path in UTF-8, including extension. More... | |
static uintmax_t | fileSize (const std::string &path) |
Returns the file size of a FILE in UTF-8. More... | |
static std::string | getNativeSeparator () |
Returns the native separator based on the Operational System. More... | |
static bool | isDirectory (const std::string &path) |
Checks if a given path in UTF-8 is a directory. More... | |
static bool | isEmpty (const std::string &path) |
Checks if a given path in UTF-8 is an empty directory. More... | |
static bool | isRegularFile (const std::string &path) |
Checks if a given path in UTF-8 is a regular file. More... | |
static std::vector< std::string > | listDirectory (const std::string &path) |
Lists a directory from a given path in UTF-8. More... | |
static std::string | parentPath (const std::string &path) |
Retrives the parent path of a given file path in UTF-8. For /home/files/fileName.shp, it will return /home/files. More... | |
static std::string | readFromFile (const std::string &filePath) |
Read file and returns the contents of the file. More... | |
static bool | remove (const std::string &path) |
Removes a file or directory from a given path in UTF-8. More... | |
static void | rename (const std::string &old_p, const std::string &new_p) |
Renames a file or directory from a given path in UTF-8. More... | |
static std::string | stem (const std::string &path) |
Retrives the filename of a given file path in UTF-8, excluding extension. More... | |
static std::string | systemCompletePath (const std::string &path) |
Composes an absolute path for the given path in UTF-8. More... | |
static std::string | tempDirectoryPath () |
Retrives the temp directory in UTF-8. More... | |
static std::string | uniquePath (const std::string &format="%%%%-%%%%-%%%%-%%%%") |
Retrives an unique path generated by a given format. More... | |
static void | writeToFile (const std::string &filePath, const std::string &content) |
will create a copy of the file before saving. More... | |
Private Member Functions | |
FileSystem () | |
FileSystem (FileSystem const &) | |
FileSystem & | operator= (FileSystem const &) |
~FileSystem () | |
Static Private Member Functions | |
static std::string | createTempFileDirectoryPathString () |
static std::string | createTempFilePathString (const std::string &filePath) |
static std::string | getFileContent (const std::string &filePath) |
Get file content. More... | |
static bool | isBlank (const std::string &filePath) |
Checks whether the file contains full non-printable character content. More... | |
static bool | isInvalid (const std::string &content) |
Checks whether the contents contains full non-printable character content. More... | |
Static Private Attributes | |
static boost::mutex | mutexFileSystem |
Used to perform the tasks: write to file or read from file. More... | |
A class for handling system files and paths using UTF-8 strings.
Definition at line 53 of file FileSystem.h.
|
private |
|
private |
|
private |
|
static |
Retrives the absolute path for the given path in UTF-8.
path | Path in UTF-8. |
|
static |
Adjusts the given path to generic form.
Documentation from Boost: In general, Boost.Filesystem differentiates between native paths and generic paths. Native paths are operating system specific and must be used when calling operating system functions. Generic paths are portable and independent of the operating system.
|
static |
Adjusts the given path to native form.
Documentation from Boost: In general, Boost.Filesystem differentiates between native paths and generic paths. Native paths are operating system specific and must be used when calling operating system functions. Generic paths are portable and independent of the operating system.
|
static |
Copies a file.
from | Path in UTF-8 for the file to be copied. |
to | Path in UTF-8 for the copy output. |
|
static |
Creates a directory for any element of path that does not exist.
path | Path in UTF-8. |
|
static |
Creates a directory from a given path in UTF-8.
path | Path in UTF-8. |
|
staticprivate |
|
staticprivate |
|
static |
Retrives the current working directory path in UTF-8.
|
static |
|
static |
Checks if a given path in UTF-8 exists.
path | Path in UTF-8. |
|
static |
Retrives the extension of a given file path in UTF-8.
path | File path in UTF-8. |
|
static |
Retrives the filename of a given file path in UTF-8, including extension.
path | File path in UTF-8. |
|
static |
Returns the file size of a FILE in UTF-8.
path | Path in UTF-8. |
te::core::Exception | if the given path doesn't exists or its used in a directory. |
|
staticprivate |
Get file content.
file | path |
|
static |
Returns the native separator based on the Operational System.
|
staticprivate |
Checks whether the file contains full non-printable character content.
file | path |
|
static |
Checks if a given path in UTF-8 is a directory.
path | Path in UTF-8. |
|
static |
Checks if a given path in UTF-8 is an empty directory.
path | Path in UTF-8. |
|
staticprivate |
Checks whether the contents contains full non-printable character content.
file | path |
|
static |
Checks if a given path in UTF-8 is a regular file.
path | File path in UTF-8. |
Referenced by te::common::ApplicationSettings::load().
|
static |
Lists a directory from a given path in UTF-8.
path | Path in UTF-8. |
|
private |
|
static |
Retrives the parent path of a given file path in UTF-8. For /home/files/fileName.shp, it will return /home/files.
path | File path in UTF-8. |
|
static |
Read file and returns the contents of the file.
Read file, in case of corruption use the copy. Returns the contents of the file.
|
static |
Removes a file or directory from a given path in UTF-8.
path | Path in UTF-8. |
Referenced by te::common::ApplicationSettings::update().
|
static |
Renames a file or directory from a given path in UTF-8.
old_p | Old name in UTF-8. |
new_p | New name in UTF-8. |
|
static |
Retrives the filename of a given file path in UTF-8, excluding extension.
path | File path in UTF-8. |
|
static |
Composes an absolute path for the given path in UTF-8.
path | Path in UTF-8. |
|
static |
Retrives the temp directory in UTF-8.
|
static |
Retrives an unique path generated by a given format.
format | The format used to create a unique path. e.g.: "%%%%-%%%%-%%%%-%%%%" |
Referenced by te::rp::Matrix< rg::BaatzFeatureType >::createNewDiskFile().
|
static |
will create a copy of the file before saving.
In the write to file, this method will create a copy of the file before saving. If it gets corrupted in the process, when using the read from file method will replace the corrupted file with the copy.
|
staticprivate |
Used to perform the tasks: write to file or read from file.
Definition at line 323 of file FileSystem.h.