FEDEM Solver
R8.0
Source code of the dynamics solver
|
Utilities for file path handling. More...
Functions | |
size_t | checkName (char *thePath, size_t length) |
Converts file pathnames from UNIX to Windows syntax and vice versa. More... | |
std::string & | checkName (std::string &thePath) |
C++ wrapper for FFaFilePath::checkName(char*,size_t). More... | |
std::string & | unixStyle (std::string &thePath) |
Modify the given path to using UNIX-style path separators. More... | |
std::string | unixStyle (const std::string &thePath) |
Return a copy of the given path with UNIX-style path separators. More... | |
bool | hasPath (const std::string &fileName) |
Checks if the provided fileName has a path. More... | |
bool | isRelativePath (const std::string &pathName) |
Determines if path is relative or absolute. More... | |
bool | isExtension (const std::string &fileName, const std::string &ext) |
Checks if ext is the extension of fName. More... | |
std::string | getPath (const std::string &fullPath, bool keepSlash=true) |
Returns the path part of fullPath. More... | |
std::string | getFileName (const std::string &fullPath) |
Returns the file name part of fullPath. More... | |
std::string | getExtension (const std::string &fileName) |
Returns the extension of fName. More... | |
std::string | getBaseName (const std::string &fileName, bool removePath=false) |
Returns the file name without extension. More... | |
std::string | appendFileNameToPath (const std::string &path, const std::string &fName) |
Appends fileName to path. More... | |
std::string & | appendToPath (std::string &path, const std::string &fName) |
Appends fileName to path. More... | |
std::string & | makeItAbsolute (std::string &fName, const std::string &path) |
Makes fileName an absolute pathname by prefixing it with absPath. More... | |
std::string & | makeItRelative (std::string &fName, const std::string &path) |
Makes fileName a relative pathname with respect to absPath. More... | |
std::string & | setPath (std::string &fName, const std::string &path) |
Replaces the current path in fileName with path. More... | |
char | getPathSeparator () |
Returns the path separator for this system. More... | |
std::string & | addExtension (std::string &fileName, const std::string &ext) |
Adds ext to fileName, if not already present. More... | |
std::string & | addExtension (std::string &fileName, const std::vector< std::string > &exts) |
Checks fName for existing extension in exts. More... | |
std::string | getRelativeFilename (const std::string ¤tDirectory, const std::string &absoluteFilename) |
Returns the relative path name with respect to an absolute path. More... | |
std::string | distillName (const std::string &filePath, bool removePath=false) |
Checks for illegal characters in file names. More... | |
Utilities for file path handling.
std::string & FFaFilePath::addExtension | ( | std::string & | fName, |
const std::string & | ext | ||
) |
Adds ext to fileName, if not already present.
If fileName has another extension, that extension is replaced by ext.
std::string & FFaFilePath::addExtension | ( | std::string & | fName, |
const std::vector< std::string > & | exts | ||
) |
Checks fName for existing extension in exts.
If not found, adds the first.
std::string FFaFilePath::appendFileNameToPath | ( | const std::string & | path, |
const std::string & | fileName | ||
) |
std::string & FFaFilePath::appendToPath | ( | std::string & | path, |
const std::string & | fName | ||
) |
Appends fileName to path.
size_t FFaFilePath::checkName | ( | char * | thePath, |
size_t | length | ||
) |
Converts file pathnames from UNIX to Windows syntax and vice versa.
std::string & FFaFilePath::checkName | ( | std::string & | thePath | ) |
C++ wrapper for FFaFilePath::checkName(char*,size_t).
std::string FFaFilePath::distillName | ( | const std::string & | filePath, |
bool | removePath = false |
||
) |
Checks for illegal characters in file names.
Utility method to get rid of characters we don't want to have in a file name. If removePath is true, all characters up to and including the last '/' or '\' character are removed, assuming they are the directory path.
std::string FFaFilePath::getBaseName | ( | const std::string & | fName, |
bool | removePath = false |
||
) |
Returns the file name without extension.
Beware that if fName has a path, that will be included as well, unless removePath is true.
std::string FFaFilePath::getExtension | ( | const std::string & | fileName | ) |
Returns the extension of fName.
std::string FFaFilePath::getFileName | ( | const std::string & | fullPath | ) |
Returns the file name part of fullPath.
std::string FFaFilePath::getPath | ( | const std::string & | fullPath, |
bool | keepTrailingSlash = true |
||
) |
Returns the path part of fullPath.
It is equivalent to the UNIX command "dirname", except that the trailing '/', after removing the file name part, is retained when keepTrailingSlash is true.
char FFaFilePath::getPathSeparator | ( | ) |
Returns the path separator for this system.
std::string FFaFilePath::getRelativeFilename | ( | const std::string & | currentDirectory, |
const std::string & | absoluteFilename | ||
) |
Returns the relative path name with respect to an absolute path.
Given the absolute current directory and an absolute file name, the relative file name is returned. For example, if the current directory is
and we provide the filename
then this method will return
bool FFaFilePath::hasPath | ( | const std::string & | fileName | ) |
Checks if the provided fileName has a path.
bool FFaFilePath::isExtension | ( | const std::string & | fileName, |
const std::string & | ext | ||
) |
Checks if ext is the extension of fName.
bool FFaFilePath::isRelativePath | ( | const std::string & | pathName | ) |
Determines if path is relative or absolute.
std::string & FFaFilePath::makeItAbsolute | ( | std::string & | fileName, |
const std::string & | absPath | ||
) |
Makes fileName an absolute pathname by prefixing it with absPath.
If fileName already is an absolute path, that name is returned.
std::string & FFaFilePath::makeItRelative | ( | std::string & | fName, |
const std::string & | path | ||
) |
Makes fileName a relative pathname with respect to absPath.
std::string & FFaFilePath::setPath | ( | std::string & | fName, |
const std::string & | path | ||
) |
Replaces the current path in fileName with path.
std::string FFaFilePath::unixStyle | ( | const std::string & | thePath | ) |
Return a copy of the given path with UNIX-style path separators.
std::string & FFaFilePath::unixStyle | ( | std::string & | thePath | ) |
Modify the given path to using UNIX-style path separators.