BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
FileSystemUtils Namespace Reference

Utility functions to deal with file system. More...

Functions

std::string extension (const std::string &path)
 Returns extension of given filename. More...
 
std::string extensions (const std::string &path)
 Returns extension(s) of given filename. More...
 
bool createDirectory (const std::string &dir_name)
 Creates directory in current directory.
 
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 > filesInDirectory (const std::string &dir_name)
 Returns filenames of files in directory.
 
std::string jointPath (const std::string &spath1, const std::string &spath2)
 Returns joint path name.
 
std::string filename (const std::string &path)
 Returns path without directory part ("Foo/Bar/Doz.int.gz" -> "Doz.int.gz")
 
std::string stem (const std::string &path)
 Returns filename without extension. More...
 
std::string stem_ext (const std::string &path)
 Returns filename without extension(s). More...
 
std::vector< std::string > glob (const std::string &dir, const std::string &pattern)
 Returns file names that agree with a regex glob pattern.
 
std::wstring convert_utf8_to_utf16 (const std::string &str)
 Converts utf8 string represented by std::string to utf16 string represented by std::wstring.
 
bool IsFileExists (const std::string &str)
 Returns true if file with given name exists on disk.
 

Detailed Description

Utility functions to deal with file system.

Function Documentation

◆ extension()

std::string FileSystemUtils::extension ( const std::string &  path)

Returns extension of given filename.

"/home/user/filename.int" -> ".int", "/home/user/filename.int.gz" -> ".gz"

Definition at line 24 of file FileSystemUtils.cpp.

◆ extensions()

std::string FileSystemUtils::extensions ( const std::string &  path)

Returns extension(s) of given filename.

"/home/user/filename.int" -> ".int", "/home/user/filename.int.gz" -> ".int.gz"

Definition at line 29 of file FileSystemUtils.cpp.

◆ stem()

std::string FileSystemUtils::stem ( const std::string &  path)

Returns filename without extension.

"/home/user/filename.int" -> "filename", "/home/user/filename.int.gz" -> "filename.int"

Definition at line 97 of file FileSystemUtils.cpp.

◆ stem_ext()

std::string FileSystemUtils::stem_ext ( const std::string &  path)

Returns filename without extension(s).

"/home/user/filename.int" -> "filename", "/home/user/filename.int.gz" -> "filename"

Definition at line 102 of file FileSystemUtils.cpp.