Fennel: FileSystem Class Reference (original) (raw)
FileSystem provides some static utility methods for manipulating the OS file system. More...
#include <[FileSystem.h](FileSystem%5F8h-source.html)>
| Static Public Member Functions | |
|---|---|
| static void | remove (char const *filename) |
| static bool | setFileAttributes (char const *filename, bool readOnly=1) |
| static bool | doesFileExist (char const *filename) |
| static void | getDiskFreeSpace (char const *path, FileSize &availableSpace) |
| Determines how much free space is available in a file system. |
Detailed Description
FileSystem provides some static utility methods for manipulating the OS file system.
Definition at line 33 of file FileSystem.h.
Member Function Documentation
| void FileSystem::remove | ( | char const * | filename | ) | [static] |
|---|
| bool FileSystem::setFileAttributes | ( | char const * | filename, |
|---|---|---|---|
| bool | readOnly = 1 | ||
| ) | [static] |
Definition at line 68 of file FileSystem.cpp.
Referenced by remove().
00069 { 00070 mode_t mode = S_IRUSR; 00071 if (!readOnly) { 00072 mode |= S_IWUSR; 00073 } 00074 return ::chmod(filename,mode) ? 0 : 1; 00075 }
| bool FileSystem::doesFileExist | ( | char const * | filename | ) | [static] |
|---|
| void FileSystem::getDiskFreeSpace | ( | char const * | path, |
|---|---|---|---|
| FileSize & | availableSpace | ||
| ) | [static] |
Determines how much free space is available in a file system.
Parameters:
| path | the pathname of any file within the file system |
|---|---|
| availableSpace | returns the number of free bytes available in the file system |
Definition at line 77 of file FileSystem.cpp.
Referenced by Database::initiateBackup(), and BackupRestoreTest::testBackupCleanup().
00078 { 00079 #ifdef MSVC 00080 throw FennelExcn(FennelResource::instance().unsupportedOperation("statvfs")); 00081 #else 00082 struct statvfs buf; 00083 int rc = statvfs(path, &buf); 00084 if (rc == -1) { 00085 throw SysCallExcn("statvfs call failed"); 00086 } 00087 availableSpace = buf.f_bsize * buf.f_bavail; 00088 #endif 00089 }
The documentation for this class was generated from the following files:
- /home/pub/open/dev/fennel/common/FileSystem.h
- /home/pub/open/dev/fennel/common/FileSystem.cpp
