10 #ifndef __stir_FILEPATH_H__ 11 #define __stir_FILEPATH_H__ 55 FilePath(
const std::string& __str,
bool _run_checks =
true);
60 bool is_directory()
const;
64 bool is_regular_file()
const;
66 bool is_writable()
const;
69 static bool is_absolute(
const std::string& _filename_with_directory);
71 static bool exists(
const std::string& s);
73 static std::string get_current_working_directory();
80 FilePath append(
const std::string& p);
82 static void append_separator(std::string& s);
93 std::string get_path()
const;
95 std::string get_path_only()
const;
100 std::string get_filename_no_extension()
const;
103 std::string get_extension()
const;
105 std::string get_as_string()
const;
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();
Implementations of inline functions for class stir::FilePath.
char * prepend_directory_name(char *filename_with_directory, const char *const directory_name)
Prepend directory_name to the filename, but only if !is_absolute_pathname(filename_with_directory) ...
Definition: utilities.cxx:285
std::string separator
The separator for the current OS.
Definition: FilePath.h:145
The FilePath class.
Definition: FilePath.h:45
std::string my_string
This is the string holding the data.
Definition: FilePath.h:143
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
string & add_extension(string &file_in_directory_name, const string &extension)
Append extension if none present.
Definition: utilities.cxx:209
string::size_type find_pos_of_filename(const string &filename_with_directory)
return the position of the start of the filename (i.e. after directory specifications) ...
Definition: utilities.cxx:135
string & replace_extension(string &file_in_directory_name, const string &extension)
Replace extension (or append if none present)
Definition: utilities.cxx:236
string::size_type find_pos_of_extension(const string &file_in_directory_name)
find the position of the '.' of the extension
Definition: utilities.cxx:185
basic configuration include file
string get_filename(const string &filename_with_directory)
return a std::string containing only the filename (i.e. after directory specifications) ...
Definition: utilities.cxx:161