diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index 1ec27351d..2b388cd15 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -555,6 +555,7 @@ bool Foam::chMod(const fileName& name, const mode_t m) } +// Return the file mode mode_t Foam::mode(const fileName& name) { fileStat fileStatus(name); @@ -569,6 +570,7 @@ mode_t Foam::mode(const fileName& name) } +// Return the file type: FILE or DIRECTORY Foam::fileName::Type Foam::type(const fileName& name) { mode_t m = mode(name); @@ -588,24 +590,28 @@ Foam::fileName::Type Foam::type(const fileName& name) } +// Does the name exist in the filing system? bool Foam::exists(const fileName& name, const bool checkGzip) { return mode(name) || isFile(name, checkGzip); } +// Does the directory exist? bool Foam::isDir(const fileName& name) { return S_ISDIR(mode(name)); } +// Does the file exist? bool Foam::isFile(const fileName& name, const bool checkGzip) { return S_ISREG(mode(name)) || (checkGzip && S_ISREG(mode(name + ".gz"))); } +// Return size of file off_t Foam::fileSize(const fileName& name) { fileStat fileStatus(name); @@ -620,6 +626,7 @@ off_t Foam::fileSize(const fileName& name) } +// Return time of last file modification time_t Foam::lastModified(const fileName& name) { fileStat fileStatus(name); @@ -634,6 +641,7 @@ time_t Foam::lastModified(const fileName& name) } +// Read a directory and return the entries as a string list Foam::fileNameList Foam::readDir ( const fileName& directory, @@ -729,6 +737,7 @@ Foam::fileNameList Foam::readDir } +// Copy, recursively if necessary, the source to the destination bool Foam::cp(const fileName& src, const fileName& dest) { // Make sure source exists. @@ -828,6 +837,7 @@ bool Foam::cp(const fileName& src, const fileName& dest) } +// Create a softlink. dst should not exist. Returns true if successful. bool Foam::ln(const fileName& src, const fileName& dst) { if (POSIX::debug) @@ -865,6 +875,7 @@ bool Foam::ln(const fileName& src, const fileName& dst) } +// Rename srcFile dstFile bool Foam::mv(const fileName& src, const fileName& dst) { if (POSIX::debug) @@ -890,6 +901,8 @@ bool Foam::mv(const fileName& src, const fileName& dst) } +//- Rename to a corresponding backup file +// If the backup file already exists, attempt with "01" .. "99" index bool Foam::mvBak(const fileName& src, const std::string& ext) { if (POSIX::debug) @@ -927,6 +940,8 @@ bool Foam::mvBak(const fileName& src, const std::string& ext) } + +// Remove a file, returning true if successful otherwise false bool Foam::rm(const fileName& file) { if (POSIX::debug) @@ -947,6 +962,7 @@ bool Foam::rm(const fileName& file) } +// Remove a dirctory and its contents bool Foam::rmDir(const fileName& directory) { if (POSIX::debug) @@ -1236,7 +1252,7 @@ bool Foam::dlSymFound(void* handle, const std::string& symbol) } } - +#ifdef NOT_SURE_HOW_TO_USE_THIS static int collectLibsCallback ( struct dl_phdr_info *info, @@ -1263,6 +1279,7 @@ Foam::fileNameList Foam::dlLoaded() } return libs; } +#endif void Foam::osRandomSeed(const label seed)