40 static std::string
findFile(
const std::string& path,
bool silent =
false);
63 static std::string findFile(
const std::string& path,
const std::string& dataType,
bool silent =
false);
66 static bool fileExists(
const std::string& filename);
70 static bool isFile(
const std::string& filename);
72 static bool isDir(
const std::string& filename);
74 static bool isSymLink(
const std::string& filename);
77 static std::string
calculateMD5(
const std::string& filename);
92 static bool loadLibrary(std::string library,
bool fullname =
true);
105 explicit Lock(
const std::string& fileName,
bool readonly =
false);
120 bool lock(
int timeout = 300,
bool ignoreErrors =
false);
131 explicit TemporaryFile(std::ios_base::openmode mode = std::ios_base::trunc | std::ios_base::out);
154 static std::string findFile(
const std::string& path,
const std::vector<std::string>& dirs,
bool silent);
Helper class for locking a file.
bool m_readOnly
if this is a read-only lock (multiple processes can hold one).
int m_file
File descriptor of file to be locked.
bool lock(int timeout=300, bool ignoreErrors=false)
Try to lock the file.
Helper file to create a temporary file and ensure deletion if object goes out of scope.
~TemporaryFile()
close file and delete on destruction
TemporaryFile(const TemporaryFile &)=delete
prevent assignment
std::string getName() const
get filename of the temporary file
std::string m_filename
filename of the temporary file
TemporaryFile & operator=(const TemporaryFile &)=delete
prevent copy constructor
TemporaryFile(TemporaryFile &&)=delete
and no move construction as basic_ios doesn't allow that
Utility functions related to filename validation and filesystem access.
static bool loadLibrary(std::string library, bool fullname=true)
Load a shared library.
static bool isSymLink(const std::string &filename)
Check if filename points to an existing symbolic link.
FileSystem()=delete
no instances.
static bool fileDirExists(const std::string &filename)
Check if the dir containing the filename exists.
static bool isFile(const std::string &filename)
Check if filename points to an existing file.
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
static std::string calculateMD5(const std::string &filename)
Calculate the MD5 checksum of a given file.
static std::string calculateAdler32(const std::string &filename)
Calculate the Adler-32 checksum of a given file.
static bool isDir(const std::string &filename)
Check if filename points to an existing directory.
static bool fileExists(const std::string &filename)
Check if the file with given filename exists.
Abstract base class for different kinds of events.