Manages file pathes, manupulate and combines them. More...
Public Types | |
using | pathType = std::filesystem::path |
Public Member Functions | |
fileSystem () | |
Default. More... | |
fileSystem (const word &wPath) | |
From full path. More... | |
fileSystem (const word &dir, const word &file) | |
From dir and file name. More... | |
fileSystem (const char *dir, const char *file="") | |
From dir and file name. More... | |
fileSystem (const pathType &path) | |
Copy. More... | |
fileSystem (const fileSystem &)=default | |
Copy. More... | |
fileSystem (fileSystem &&)=default | |
Move. More... | |
fileSystem & | operator= (const fileSystem &)=default |
Copy assignment. More... | |
fileSystem & | operator= (fileSystem &&)=default |
Move assignment. More... | |
~fileSystem ()=default | |
Destructor. More... | |
bool | isDir () const |
Is directory? More... | |
const pathType & | path () const |
Const access to path. More... | |
word | wordPath () const |
Path in word type. More... | |
fileSystem | dirPath () const |
Dir part of the path. More... | |
word | fileName () const |
File name part of the path (if any) More... | |
fileSystem | absolute () const |
Absolute path of this. More... | |
fileSystem | canonical () const |
Canonical path of this (it should exist) More... | |
fileSystem | relative (const fileSystem &base) const |
relative path of this this with respect to base More... | |
bool | dirExist () const |
Only operate on dir path Check if the dir path exists. More... | |
bool | exist () const |
Check if the path exists. More... | |
fileSystem | createDirs () const |
Operate on dir path only Create dir based on the path and returns the canonical path. More... | |
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 More... | |
void | operator/= (const fileSystem &fs) |
It operates on dir path only Add the dir path of fs to this More... | |
fileSystem | operator() (bool retDir=true) const |
Return the dir path of this. More... | |
Static Public Member Functions | |
static fileSystem | CWD () |
return current working directory More... | |
Static Protected Member Functions | |
static bool | validFileName (const word &name) |
Is name is valid for a file? More... | |
static bool | checkFileName (const word &name) |
Is a valid file name? More... | |
Protected Attributes | |
pathType | path_ |
File path. More... | |
bool | isDir_ |
Is this a directory path? More... | |
Static Protected Attributes | |
static word | notPermittedCharsFile = word(" ") + word("&\t\n;:?*/<>\"?\'") |
Not premitted chars in file name More... | |
Friends | |
fileSystem | operator/ (const fileSystem &fs1, const fileSystem &fs2) |
Create a dir path from dir path of fs1 and fas2 in the form of fs1/fs2 More... | |
iOstream & | operator<< (iOstream &os, const fileSystem &fs) |
std::ostream & | operator<< (std::ostream &os, const fileSystem &fs) |
Manages file pathes, manupulate and combines them.
Definition at line 71 of file fileSystem.hpp.
using pathType = std::filesystem::path |
Definition at line 75 of file fileSystem.hpp.
|
inline |
Default.
Definition at line 111 of file fileSystem.hpp.
Referenced by fileSystem::CWD().
|
explicit |
From full path.
Definition at line 44 of file fileSystem.cpp.
References fileSystem::checkFileName(), fatalExit, fileSystem::fileName(), and fileSystem::isDir_.
fileSystem | ( | const word & | dir, |
const word & | file | ||
) |
From dir and file name.
Definition at line 55 of file fileSystem.cpp.
References pFlow::endl(), fatalErrorInFunction, and fatalExit.
fileSystem | ( | const char * | dir, |
const char * | file = "" |
||
) |
From dir and file name.
Definition at line 78 of file fileSystem.cpp.
|
explicit |
Copy.
Definition at line 85 of file fileSystem.cpp.
|
default |
Copy.
|
default |
Move.
|
default |
Destructor.
|
inlinestaticprotected |
Is name is valid for a file?
Definition at line 90 of file fileSystem.hpp.
References fileSystem::notPermittedCharsFile.
Referenced by fileSystem::checkFileName().
|
staticprotected |
Is a valid file name?
Definition at line 27 of file fileSystem.cpp.
References pFlow::endl(), fatalErrorInFunction, fileSystem::notPermittedCharsFile, and fileSystem::validFileName().
Referenced by fileSystem::fileSystem().
|
inlinestatic |
return current working directory
Definition at line 101 of file fileSystem.hpp.
References fileSystem::fileSystem().
Referenced by pFlow::CWD().
|
default |
Copy assignment.
|
default |
Move assignment.
|
inline |
|
inline |
Const access to path.
Definition at line 154 of file fileSystem.hpp.
References fileSystem::path_.
Referenced by pFlow::containingFiles(), pFlow::isDirectory(), pFlow::isRegularFile(), repository::path(), IOfileHeader::path(), and pFlow::subDirectories().
|
inline |
Path in word type.
Definition at line 160 of file fileSystem.hpp.
References fileSystem::path_.
Referenced by fileSeries::addTimeFile(), pFlow::PFtoVTK::convertTimeFolderPointFields(), pFlow::PFtoVTK::convertTimeFolderPointFieldsSelected(), pFlow::TSFtoVTK::convertTimeFolderTriSurfaceFieldsSeparate(), pFlow::TSFtoVTK::convertTimeFolderTriSurfaceFieldsSingle(), fileDictionary::fileDictionary(), systemControl::getRunName(), systemControl::getTopFolder(), fileStream::openInFile(), and fileStream::openOutFile().
pFlow::fileSystem dirPath | ( | ) | const |
Dir part of the path.
Definition at line 91 of file fileSystem.cpp.
Referenced by fileStream::openOutFile(), and pFlow::operator/().
pFlow::word fileName | ( | ) | const |
File name part of the path (if any)
Definition at line 105 of file fileSystem.cpp.
References pFlow::endl(), fatalErrorInFunction, and fatalExit.
Referenced by fileSystem::fileSystem().
pFlow::fileSystem absolute | ( | ) | const |
Absolute path of this.
Definition at line 125 of file fileSystem.cpp.
References pFlow::endl(), fatalErrorInFunction, fatalExit, fileSystem::isDir_, and fileSystem::path_.
pFlow::fileSystem canonical | ( | ) | const |
Canonical path of this (it should exist)
Definition at line 149 of file fileSystem.cpp.
References pFlow::endl(), fatalErrorInFunction, fatalExit, fileSystem::isDir_, and fileSystem::path_.
Referenced by systemControl::getRunName(), and systemControl::getTopFolder().
pFlow::fileSystem relative | ( | const fileSystem & | base | ) | const |
relative path of this this with respect to base
Definition at line 170 of file fileSystem.cpp.
References fileSystem::path_.
Referenced by fileSeries::addTimeFile().
bool dirExist | ( | ) | const |
Only operate on dir path Check if the dir path exists.
Definition at line 176 of file fileSystem.cpp.
References pFlow::endl(), fatalErrorInFunction, and fatalExit.
bool exist | ( | ) | const |
Check if the path exists.
Definition at line 192 of file fileSystem.cpp.
References pFlow::endl(), fatalErrorInFunction, and fatalExit.
Referenced by fileStream::openInFile().
pFlow::fileSystem createDirs | ( | ) | const |
Operate on dir path only Create dir based on the path and returns the canonical path.
Definition at line 208 of file fileSystem.cpp.
References pFlow::endl(), fatalErrorInFunction, and fatalExit.
Referenced by fileStream::openOutFile().
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
Definition at line 245 of file fileSystem.cpp.
References fatalExit.
void operator/= | ( | const fileSystem & | fs | ) |
It operates on dir path only Add the dir path of fs to this
Definition at line 265 of file fileSystem.cpp.
References pFlow::endl(), fatalErrorInFunction, and fatalExit.
pFlow::fileSystem operator() | ( | bool | retDir = true | ) | const |
Return the dir path of this.
Definition at line 235 of file fileSystem.cpp.
|
friend |
Create a dir path from dir path of fs1 and fas2 in the form of fs1/fs2
|
friend |
|
friend |
|
protected |
File path.
Definition at line 80 of file fileSystem.hpp.
Referenced by fileSystem::absolute(), fileSystem::canonical(), pFlow::operator/(), pFlow::operator<<(), fileSystem::path(), fileSystem::relative(), and fileSystem::wordPath().
|
protected |
Is this a directory path?
Definition at line 83 of file fileSystem.hpp.
Referenced by fileSystem::absolute(), fileSystem::canonical(), fileSystem::fileSystem(), and fileSystem::isDir().
Not premitted chars in file name
Definition at line 87 of file fileSystem.hpp.
Referenced by fileSystem::checkFileName(), and fileSystem::validFileName().