Functions
gnsstk::FileUtils Namespace Reference

Detailed Description

These functions and macros help process files and directories.

Functions

bool fileAccessCheck (const char *fname, std::ios::openmode mode=std::ios::in)
 
bool fileAccessCheck (const std::string &fname, std::ios::openmode mode=std::ios::in)
 
int makeDir (const char *path, unsigned mode)
 
int makeDir (const std::string &path, unsigned mode)
 

Function Documentation

◆ fileAccessCheck() [1/2]

bool gnsstk::FileUtils::fileAccessCheck ( const char *  fname,
std::ios::openmode  mode = std::ios::in 
)
inline

Returns true if the file exists. Only readability is verified unless the user inputs the openmode of interest.

Parameters
[in]fnameName of the file to check
[in]modeMode of access to check (default is readable, std::ios::in)
Warning
This method fails to work correctly under Debian 7, which seems to have a bug in the OS/system calls that erroneously allow opening read-only files with write access. There's nothing we can do about this.
Returns
true if the file can be accessed

Definition at line 151 of file FileUtils.hpp.

◆ fileAccessCheck() [2/2]

bool gnsstk::FileUtils::fileAccessCheck ( const std::string &  fname,
std::ios::openmode  mode = std::ios::in 
)
inline

Definition at line 158 of file FileUtils.hpp.

◆ makeDir() [1/2]

int gnsstk::FileUtils::makeDir ( const char *  path,
unsigned  mode 
)
inline

makeDir that takes a char* for an argument.

Parameters
paththe full path of the directory you want created
modethe permission of the new directory (like 0755)
Returns
always 0

Definition at line 134 of file FileUtils.hpp.

◆ makeDir() [2/2]

int gnsstk::FileUtils::makeDir ( const std::string &  path,
unsigned  mode 
)
inline

Creates a hierarchy of directories rather than just one dir. This intentionally doesn't check the mkdir return codes because there is no difference between return codes for directories that already exist and error creating new ones.

Parameters
paththe full path of the directory you want created
modethe permission of the new directory (like 0755)
Returns
always 0

Definition at line 106 of file FileUtils.hpp.



gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:46