10#ifndef __stir_FILEPATH_H__
11#define __stir_FILEPATH_H__
55 FilePath(
const std::string& __str,
bool _run_checks =
true);
69 static bool is_absolute(
const std::string& _filename_with_directory);
71 static bool exists(
const std::string& s);
75 FilePath
append(
const FilePath& p);
80 FilePath
append(
const std::string& p);
107 inline std::string get_string()
const;
109 inline bool operator==(
const FilePath& other);
111 inline bool operator==(
const std::string& other);
113 inline void operator=(
const FilePath& other);
120 inline void operator=(
const std::string& other);
126 const std::vector<std::string> split(
const std::string& s,
const char* c =
"");
129 std::string merge(
const std::string& first,
const std::string& sec);
132 inline void initSeparator();
136 std::string::size_type find_pos_of_filename()
const;
139 std::string::size_type find_pos_of_extension()
const;
Implementations of inline functions for class stir::FilePath.
std::string separator
The separator for the current OS.
Definition FilePath.h:145
bool is_writable() const
On Windows the attribute INVALID_FILE_ATTRIBUTES is used. Which is not quite the same.
Definition FilePath.cxx:102
std::string get_filename_no_extension() const
Convinience function which returns the filename withouth the extension.
Definition FilePath.cxx:263
std::string get_path_only() const
Get the path from string. If no path in string returns empty string.
Definition FilePath.cxx:229
FilePath append(const FilePath &p)
Create a new folder,by FilePath, and return its path as FilePath.
Definition FilePath.cxx:139
std::string get_filename() const
Get only the filename An inherent functionality from utilities is that on Windows all separators will...
Definition FilePath.cxx:242
std::string get_path() const
Get path from string.
Definition FilePath.cxx:217
std::string my_string
This is the string holding the data.
Definition FilePath.h:143
static void append_separator(std::string &s)
Append the separator.
Definition FilePath.cxx:399
void prepend_directory_name(const std::string &p)
If path is no absolute then prepend the p string.
Definition FilePath.cxx:444
void replace_extension(const std::string &e)
Replace extension.
Definition FilePath.cxx:206
bool is_directory() const
Returns true if my_string points to a directory.
Definition FilePath.cxx:64
static bool is_absolute(const std::string &_filename_with_directory)
Returns true if the _filename_with_directory is an absolute path.
Definition FilePath.cxx:413
void add_extension(const std::string &e)
Append extension e if none is present.
Definition FilePath.cxx:198
static bool exists(const std::string &s)
Returns true if the path s already exists.
Definition FilePath.cxx:117
static std::string get_current_working_directory()
Returns the current / working directory.
Definition FilePath.cxx:324
std::string get_extension() const
Get the extension of the filename.
Definition FilePath.cxx:276
bool is_regular_file() const
Returns true if my_string points to a regular file Returns true if the path is writable.
Definition FilePath.cxx:82
std::string get_as_string() const
Return the current full string.
Definition FilePath.cxx:287
bool run_checks
Run checks on the my_string on various occations. You want this when you operate on existing paths.
Definition FilePath.h:148
basic configuration include file