![]() |
VR-Forces 4.0.4 Class Documentation
|
The DtVrvFilesystem is a wrapper around boost functions that are know to throw exceptions. More...
Static Public Member Functions | |
| static bool | createAllDirectories (const std::string &dirPath) |
| Creates all the directories from parent to child. | |
| static std::string | absolutePath (const std::string &path) |
| Get an absolute path from a relative path. | |
| static DtUnicode | absolutePath (const DtUnicode &path) |
| Get an absolute path from a relative path. | |
| static std::string | cleanPath (const std::string &path) |
| Clean a path by resolving embedded relative parts and correcting for inconsistent slashes. | |
| static DtUnicode | cleanPath (const DtUnicode &path) |
| Clean a path by resolving embedded relative parts and correcting for inconsistent slashes. | |
| static bool | isAbsolutePath (const std::string &path) |
| Check if the given path is an absolute path. | |
| static bool | exists (const std::string &path) |
| Check if the given path is exists. | |
| static bool | exists (const boost::filesystem::path &path) |
| Check if the given path is exists. | |
| static bool | equivalent (const std::string &path1, const std::string &path2) |
| Check if the two given paths are equivalent. | |
| static std::string | makeRelative (const std::string &root, const std::string &path) |
| Resolve a given path into a relative path based on a specific root. | |
| static std::string | setExtension (std::string file, std::string ext) |
| Set a new extension to a file name. | |
| static std::string | addExtension (std::string file, std::string ext) |
| Append a new extension to a file name. | |
| static std::string | extension (const std::string &file, bool withDot=false) |
| Get the extension from a file path. | |
| static std::string | extensionCaseSensitive (std::string file, bool withDot=false) |
| Get the extension from a file path. | |
| static std::string | baseName (const std::string &file) |
| Get the base name of a file, excluding the file path and extension. | |
| static std::string | directoryOfFile (const std::string &file) |
| Get the directory path containing the existing file. | |
| static std::string | directoryOfPath (const std::string &file) |
| Get the directory path of a file. | |
| static std::string | rootDirectoryOfPath (const std::string &file) |
| Get the root of the given directory. | |
| static std::string | nativePath (const std::string &path) |
| Convert the path to the native format of the platform. | |
| static DtUnicode | nativePath (const DtUnicode &path) |
| Convert the path to the native format of the platform. | |
| static bool | is_directory (const std::string &path) |
| Test whether the path is a directory or not. | |
| static bool | is_directory (const boost::filesystem::path &path) |
| Test whether the path is a directory or not. | |
| static bool | deleteFile (const std::string &file) |
| Delete the given file. | |
| template<typename PathCollection > | |
| static bool | findFile (const std::string &filePathIn, const PathCollection &paths, std::string &actualFilePathOut) |
| Find a file in a list of paths. | |
| static bool | findFileInPath (const std::string &filePathIn, const std::string &path, std::string &actualFilePathOut) |
| Find the file in a path. | |
The DtVrvFilesystem is a wrapper around boost functions that are know to throw exceptions.
These functions are all reentrent* however the working directory should not be changed.
| static bool makVrv::DtVrvFilesystem::createAllDirectories | ( | const std::string & | dirPath | ) | [static] |
Creates all the directories from parent to child.
| [in] | dirPath | is the directory path to create. |
| true | if the directory path was successfully constructed. |
| false | otherwise. |
| static std::string makVrv::DtVrvFilesystem::absolutePath | ( | const std::string & | path | ) | [static] |
Get an absolute path from a relative path.
This function resolves a relative path to an absolute path and converts inconsistent slashes to the native format.
| [in] | path | is the relative path to convert. |
| static DtUnicode makVrv::DtVrvFilesystem::absolutePath | ( | const DtUnicode & | path | ) | [static] |
Get an absolute path from a relative path.
This function resolves a relative path to an absolute path and converts inconsistent slashes to the native format.
| [in] | path | is the relative path to convert. |
| static std::string makVrv::DtVrvFilesystem::cleanPath | ( | const std::string & | path | ) | [static] |
Clean a path by resolving embedded relative parts and correcting for inconsistent slashes.
| [in] | path | is the relative or absolute path to clean. |
| static DtUnicode makVrv::DtVrvFilesystem::cleanPath | ( | const DtUnicode & | path | ) | [static] |
Clean a path by resolving embedded relative parts and correcting for inconsistent slashes.
| [in] | path | is the relative or absolute path to clean. |
| static bool makVrv::DtVrvFilesystem::isAbsolutePath | ( | const std::string & | path | ) | [static] |
Check if the given path is an absolute path.
| [in] | path | is the path to check. |
| true | if the given path is already absolute. |
| false | otherwise or failure to check. |
| static bool makVrv::DtVrvFilesystem::exists | ( | const std::string & | path | ) | [static] |
Check if the given path is exists.
| [in] | path | is the path to check. |
| true | if the given path exists in the filesystem. |
| false | otherwise or failure to check. |
Referenced by makVrv::DtManagerBackup< Manager >::backupExists(), makVrv::DtManagerBackup< Manager >::factoryExists(), and findFile().
| static bool makVrv::DtVrvFilesystem::exists | ( | const boost::filesystem::path & | path | ) | [static] |
Check if the given path is exists.
| [in] | path | is the path to check. |
| true | if the given path exists in the filesystem. |
| false | otherwise or failure to check. |
| static bool makVrv::DtVrvFilesystem::equivalent | ( | const std::string & | path1, |
| const std::string & | path2 | ||
| ) | [static] |
Check if the two given paths are equivalent.
This checks that two given paths, whether relative or absolute, both resolve to the same directory or file location.
| [in] | path1 | is the first path to check. |
| [in] | path2 | is the second path to check. |
| true | if both paths resolve to the same location. |
| false | otherwise or failure to check. |
| static std::string makVrv::DtVrvFilesystem::makeRelative | ( | const std::string & | root, |
| const std::string & | path | ||
| ) | [static] |
Resolve a given path into a relative path based on a specific root.
Using a root path location, a given path is converted to a new path relative to that root location.
For example: if the root is "C:\test" and path is "C:\temp\file.txt", the resulting path returned would be "..\file.txt".
The given root and given path values can be relative or absolute file or directory paths. If relative paths are given they are first converted to absolute paths from the current working directory.
| [in] | root | is the root path to base the relative path from. |
| [in] | path | is the path to convert to a relative path. |
| static std::string makVrv::DtVrvFilesystem::setExtension | ( | std::string | file, |
| std::string | ext | ||
| ) | [static] |
Set a new extension to a file name.
If an extension already exists, it is changed to the new extension. If the file does not have an extension the new extension is appended.
| [in] | file | is the path or name of the file. |
| [in] | ext | is the extension to set on the filename. |
| static std::string makVrv::DtVrvFilesystem::addExtension | ( | std::string | file, |
| std::string | ext | ||
| ) | [static] |
Append a new extension to a file name.
If an existing extension to the file is the same as the given extension, the file is returned unchanged. If the given file or extension are invalid values, the file is returned unchanged.
| [in] | file | is the path or name of the file. |
| [in] | ext | is the extension to append to the filename. |
| static std::string makVrv::DtVrvFilesystem::extension | ( | const std::string & | file, |
| bool | withDot = false |
||
| ) | [static] |
Get the extension from a file path.
The case of the returned extension is converted to lowercase.
| [in] | file | is the path or name of the file. |
| [in] | withDot | is a flag indicating the extension should or should not include the leading dot character. |
| static std::string makVrv::DtVrvFilesystem::extensionCaseSensitive | ( | std::string | file, |
| bool | withDot = false |
||
| ) | [static] |
Get the extension from a file path.
The case of the returned extension is preserved.
| [in] | file | is the path or name of the file. |
| [in] | withDot | is a flag indicating the extension should or should not include the leading dot character. |
| static std::string makVrv::DtVrvFilesystem::baseName | ( | const std::string & | file | ) | [static] |
Get the base name of a file, excluding the file path and extension.
For example: ...txt -> test
| [in] | file | is the path or name of the file. |
| static std::string makVrv::DtVrvFilesystem::directoryOfFile | ( | const std::string & | file | ) | [static] |
Get the directory path containing the existing file.
For example: ...txt -> ..
| [in] | file | is the path and name of the file. |
| static std::string makVrv::DtVrvFilesystem::directoryOfPath | ( | const std::string & | file | ) | [static] |
Get the directory path of a file.
For example: ...txt -> ..
| [in] | file | is the path and name of the file. |
| static std::string makVrv::DtVrvFilesystem::rootDirectoryOfPath | ( | const std::string & | file | ) | [static] |
Get the root of the given directory.
For example: data\file\test.text -> data
| [in] | file | is the file path to get the root directory from |
| static std::string makVrv::DtVrvFilesystem::nativePath | ( | const std::string & | path | ) | [static] |
Convert the path to the native format of the platform.
| [in] | path | is the path to be converted. |
| static DtUnicode makVrv::DtVrvFilesystem::nativePath | ( | const DtUnicode & | path | ) | [static] |
Convert the path to the native format of the platform.
| [in] | path | is the path to be converted. |
| static bool makVrv::DtVrvFilesystem::is_directory | ( | const std::string & | path | ) | [static] |
Test whether the path is a directory or not.
| [in] | path | is the path to be tested. |
| true | if the path is a directory and exists. |
| false | otherwise. |
| static bool makVrv::DtVrvFilesystem::is_directory | ( | const boost::filesystem::path & | path | ) | [static] |
Test whether the path is a directory or not.
| [in] | path | is the path to be tested. |
| true | if the path is a directory and exists. |
| false | otherwise. |
| static bool makVrv::DtVrvFilesystem::deleteFile | ( | const std::string & | file | ) | [static] |
Delete the given file.
| [in] | file | is the file to be deleted. |
| true | if the file was successfully deleted. |
| false | otherwise. |
Referenced by makVrv::DtManagerBackup< Manager >::deleteBackup().
| static bool makVrv::DtVrvFilesystem::findFile | ( | const std::string & | filePathIn, |
| const PathCollection & | paths, | ||
| std::string & | actualFilePathOut | ||
| ) | [inline, static] |
Find a file in a list of paths.
Iterate through a list of paths and attempt to find a file within one of the paths. The first location found in the iteration is returned.
| [in] | filePathIn | is a file or filepath to find. |
| [in] | paths | is a list of paths to check for the file. |
| [out] | actualFilePathOut | is the filepath where the file was found. |
| true | if the file exists and was found in one of the paths. |
| false | otherwise. |
References exists().
| static bool makVrv::DtVrvFilesystem::findFileInPath | ( | const std::string & | filePathIn, |
| const std::string & | path, | ||
| std::string & | actualFilePathOut | ||
| ) | [static] |
Find the file in a path.
This test tries to find an existing file in a given path. The given filepath is first tested as is within the given path, and on failure, the the filename (stripped of any file path) is then tested within the given path.
| [in] | filePathIn | is a file or filepath to find. |
| [in] | path | is the path to check for the file or filepath. |
| [out] | actualFilePathOut | is the filepath where the file was found. |
| true | if the file exists and was found. |
| false | otherwise. |