STIR
6.2.0
|
#include "stir/FilePath.h"
Public Member Functions | |
FilePath (const std::string &__str, bool _run_checks=true) | |
FilePath If the initial path exists in the disk _check should be left true. It will check that the path is writable If you want to initialize to an arbitary string then set _run_checks false. | |
bool | is_directory () const |
Returns true if my_string points to a directory. | |
bool | is_regular_file () const |
Returns true if my_string points to a regular file Returns true if the path is writable. More... | |
bool | is_writable () const |
On Windows the attribute INVALID_FILE_ATTRIBUTES is used. Which is not quite the same. | |
FilePath | append (const FilePath &p) |
Create a new folder,by FilePath, and return its path as FilePath. | |
FilePath | append (const std::string &p) |
Create a new folder,by string, and return its path. More... | |
void | prepend_directory_name (const std::string &p) |
If path is no absolute then prepend the p string. | |
void | add_extension (const std::string &e) |
Append extension e if none is present. | |
void | replace_extension (const std::string &e) |
Replace extension. | |
std::string | get_path () const |
Get path from string. | |
std::string | get_path_only () const |
Get the path from string. If no path in string returns empty string. | |
std::string | get_filename () const |
Get only the filename An inherent functionality from utilities is that on Windows all separators will be checked. | |
std::string | get_filename_no_extension () const |
Convinience function which returns the filename withouth the extension. | |
std::string | get_extension () const |
Get the extension of the filename. | |
std::string | get_as_string () const |
Return the current full string. | |
std::string | get_string () const |
bool | operator== (const FilePath &other) |
bool | operator== (const std::string &other) |
void | operator= (const FilePath &other) |
void | operator= (const std::string &other) |
Static Public Member Functions | |
static bool | is_absolute (const std::string &_filename_with_directory) |
Returns true if the _filename_with_directory is an absolute path. | |
static bool | exists (const std::string &s) |
Returns true if the path s already exists. | |
static std::string | get_current_working_directory () |
Returns the current / working directory. | |
static void | append_separator (std::string &s) |
Append the separator. | |
Protected Attributes | |
std::string | my_string |
This is the string holding the data. | |
std::string | separator |
The separator for the current OS. | |
bool | run_checks |
Run checks on the my_string on various occations. You want this when you operate on existing paths. | |
The FilePath class.
The old pathname operations are supported.
bool stir::FilePath::is_regular_file | ( | ) | const |
Returns true if my_string
points to a regular file Returns true if the path is writable.
References stir::error(), and stir::info().
Referenced by stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin< TargetT >::post_processing().
FilePath stir::FilePath::append | ( | const std::string & | p | ) |
Create a new folder,by string, and return its path.
This functions creates appends path p
to my_string
. It supports multiple new folder levels.It will try to avoid errors as permissions and non existing root path.
References stir::error().
|
inline |