16 #error no need to expose this header to Swig
20 #ifndef BORNAGAIN_BASE_UTIL_FILESYSTEMUTILS_H
21 #define BORNAGAIN_BASE_UTIL_FILESYSTEMUTILS_H
32 std::string
extension(
const std::string& path);
35 bool hasExtension(
const std::string& path,
const std::string& ref_extension);
39 std::string
extensions(
const std::string& path);
51 std::string
jointPath(
const std::string& path1,
const std::string& path2);
54 std::string
filename(
const std::string& path);
58 std::string
stem(
const std::string& path);
62 std::string
stem_ext(
const std::string& path);
65 std::vector<std::string>
glob(
const std::string& dir,
const std::string& pattern);
Utility functions to deal with file system.
std::string filename(const std::string &path)
Returns path without directory part ("Foo/Bar/Doz.int.gz" -> "Doz.int.gz")
std::string extensions(const std::string &path)
Returns extension(s) of given filename. "/home/user/filename.int" -> ".int", "/home/user/filename....
std::string jointPath(const std::string &path1, const std::string &path2)
Returns joint path name. Argument path1 may be empty, argument path2 not.
std::string stem_ext(const std::string &path)
Returns filename without extension(s). "/home/user/filename.int" -> "filename", "/home/user/filename....
bool createDirectory(const std::string &dir_name)
Creates directory in current directory.
std::string extension(const std::string &path)
Returns extension of given filename. "/home/user/filename.int" -> ".int", "/home/user/filename....
std::wstring convert_utf8_to_utf16(const std::string &str)
Converts utf8 string represented by std::string to utf16 string represented by std::wstring.
std::vector< std::string > filesInDirectory(const std::string &dir_name)
Returns filenames of files in directory.
std::string stem(const std::string &path)
Returns filename without (last) extension. "/home/user/filename.int" -> "filename",...
bool createDirectories(const std::string &dir_name)
Creates directories in current directory for any element of dir_name which doesn't exist.
std::vector< std::string > glob(const std::string &dir, const std::string &pattern)
Returns file names that agree with a regex glob pattern.
bool hasExtension(const std::string &path, const std::string &ref_extension)
Returns true if extension of path, converted to lower case, matches given reference extension.
bool IsFileExists(const std::string &path)
Returns true if file with given name exists on disk.