Go to the documentation of this file.
33 "Invalid file name supplied " << name <<
34 "the following characters are not allowd: " <<
47 isDir_(std::filesystem::is_directory(path_))
57 isDir_ = file.empty();
59 if( !isDir_ && !checkFileName(file))
68 catch (std::filesystem::filesystem_error & ec)
71 "Invalid fileSystem input:" <<
88 isDir_(std::filesystem::is_directory(path_))
100 return fileSystem(path_.parent_path().c_str());
112 return word( path_.filename());
114 catch (std::filesystem::filesystem_error & ec)
131 if( abPath = std::filesystem::absolute( path_, ec); ec )
134 "The absolute path of "<< path_.c_str() <<
" is invalid: "<<
154 if( cnPath = std::filesystem::canonical( path_, ec); ec )
157 "The canonical path of "<< path_.c_str() <<
" cannot be obtained: "<<
182 "This function only operates on dir path, the path is "<<
196 return std::filesystem::exists(path_);
198 catch (std::filesystem::filesystem_error & ec)
214 "This function only operates on dir path, the path is "<<
221 std::filesystem::create_directories(path_);
224 catch (std::filesystem::filesystem_error & ec)
247 if(!checkFileName(fileName))
259 path_ = path_.parent_path()/fileName;
264 void pFlow::fileSystem::operator /=
272 "This operator should be used on dir path only"<<
endl;
276 path_/= fs.dirPath().path_;
313 os << fs.
path_.c_str();
319 os << fs.
path_.c_str();
328 return std::filesystem::is_directory(path.
path());
333 return std::filesystem::is_regular_file(path.
path());
345 auto dOps = std::filesystem::directory_options::skip_permission_denied;
346 for(
auto& subPath: std::filesystem::directory_iterator(path.
path(), dOps) )
350 dirs.emplace_back(subPath.path());
367 auto dOps = std::filesystem::directory_options::skip_permission_denied;
368 for(
auto& subPath: std::filesystem::directory_iterator(path.
path(), dOps) )
370 if( std::filesystem::is_regular_file(subPath.path()) )
372 files.emplace_back(subPath.path());
fileSystem canonical() const
Canonical path of this (it should exist)
#define fatalExit
Fatal exit.
word fileName() const
File name part of the path (if any)
bool dirExist() const
Only operate on dir path Check if the dir path exists.
bool exist() const
Check if the path exists.
void operator+=(const word &fileName)
If this is dir path, add the filename to dir path if it is file path, replace the file name
fileSystemList containingFiles(const fileSystem &path)
A list of file paths that exist in the path.
bool isDir_
Is this a directory path?
iOstream & endl(iOstream &os)
Add newline and flush stream.
bool isRegularFile(const fileSystem &path)
free function to check if the path is regular file
Manages file pathes, manupulate and combines them.
fileSystemList subDirectories(const fileSystem &path)
A list of sub-directories that exist in path.
static word notPermittedCharsFile
Not premitted chars in file name
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
const pathType & path() const
Const access to path.
fileSystem dirPath() const
Dir part of the path.
bool isDirectory(const fileSystem &path)
Free function to check if the path is dir path.
INLINE_FUNCTION iOstream & operator<<(iOstream &str, const AB3History &ab3)
fileSystem absolute() const
Absolute path of this.
static bool validFileName(const word &name)
Is name is valid for a file?
static bool checkFileName(const word &name)
Is a valid file name?
fileSystem relative(const fileSystem &base) const
relative path of this this with respect to base
std::filesystem::path pathType
fileSystem createDirs() const
Operate on dir path only Create dir based on the path and returns the canonical path.
Interface class for any output stream.