SaneCppFileSystem.h is a library enabling manipulation of files and directories.
Quick Sheet
Dependencies
- Dependencies: (none)
- All dependencies: (none)
Features
| SC::FileSystem | SC::FileSystem |
|---|---|
| Copy Files | |
| SC::FileSystem::copyFile | SC::FileSystem::copyFile |
| Delete Files | |
| SC::FileSystem::removeFile | SC::FileSystem::removeFile |
| SC::FileSystem::removeFileIfExists | SC::FileSystem::removeFileIfExists |
| Copy Directories | |
| SC::FileSystem::copyDirectory | SC::FileSystem::copyDirectory |
| Delete Directories | |
| SC::FileSystem::removeEmptyDirectory | SC::FileSystem::removeEmptyDirectory |
| SC::FileSystem::removeDirectoryRecursive | SC::FileSystem::removeDirectoryRecursive |
| Create Directories | |
| SC::FileSystem::makeDirectory | SC::FileSystem::makeDirectory |
| SC::FileSystem::makeDirectoryIfNotExists | SC::FileSystem::makeDirectoryIfNotExists |
| SC::FileSystem::makeDirectoryRecursive | SC::FileSystem::makeDirectoryRecursive |
| Create Links | |
| SC::FileSystem::createSymbolicLink | SC::FileSystem::createSymbolicLink |
| SC::FileSystem::createHardLink | SC::FileSystem::createHardLink |
| Check Existence | |
| SC::FileSystem::exists | SC::FileSystem::exists |
| SC::FileSystem::existsAndIsFile | SC::FileSystem::existsAndIsFile |
| SC::FileSystem::existsAndIsDirectory | SC::FileSystem::existsAndIsDirectory |
| SC::FileSystem::existsAndIsLink | SC::FileSystem::existsAndIsLink |
| SC::FileSystem::canAccess | SC::FileSystem::canAccess |
| Rename files or directories | |
| SC::FileSystem::rename | SC::FileSystem::rename |
| Read / Change modification time | |
| SC::FileSystem::stat | SC::FileSystem::stat |
| SC::FileSystem::lstat | SC::FileSystem::lstat |
| SC::FileSystem::getFileStat | SC::FileSystem::getFileStat |
| SC::FileSystem::setLastModifiedTime | SC::FileSystem::setLastModifiedTime |
| SC::FileSystem::readSymbolicLink | SC::FileSystem::readSymbolicLink |
| SC::FileSystem::chmod | SC::FileSystem::chmod |
| SC::FileSystem::chown | SC::FileSystem::chown |
| SC::FileSystem::lchown | SC::FileSystem::lchown |
| SC::FileSystem::lchmod | SC::FileSystem::lchmod |
| Miscellaneous Classes | |
|---|---|
| SC::FileSystem::Operations | SC::FileSystem::Operations |
| Get Executable / Application Path | |
| SC::FileSystem::Operations::getExecutablePath | SC::FileSystem::Operations::getExecutablePath |
| SC::FileSystem::Operations::getApplicationRootDirectory | SC::FileSystem::Operations::getApplicationRootDirectory |
Status
Usable
The library contains commonly used function including links, access checks and richer path metadata.
Some lower level filesystem features are still missing, especially filesystem-level queries.
SC::FileSystem::getFileTime and SC::FileSystem::setLastModifiedTime will probably be refactored in a future dedicated class for handling stat based operations.
Blog
Some relevant blog posts are:
Description
SC::FileSystem allows all typical file operations ( exists | copy | delete | make files or directory). Some less used functions are SC::FileSystem::getFileTime and SC::FileSystem::setLastModifiedTime . The library also supports symlink and hardlink creation, reading symlink targets and checking path accessibility. The library doesn't allow reading or writing seeking inside a file, as that is domain of the File library. SC::FileSystem::init needs an absolute path to a directory and makes it a the base directory. All paths passed later on as arguments to all methods can be either absolute paths or relative. If they are relative, they will be interpreted as relative to the base directory and NOT current directory of the process. The class wants explicitly to make sure its behavior doesn't implicitly depend on current directory of process (unless it's passed explicitly to SC::FileSystem::init of course).
Use SC::Path from Strings library to parse and compose paths.
FileSystem
copyFile
copyDirectory
removeDirectoryRecursive
makeDirectoryRecursive
existsAndIsFile
existsAndIsDirectory
rename
createSymbolicLink
createHardLink
existsAndIsLink
canAccess
stat
lstat
readSymbolicLink
chmod
chown
lchown
lchmod
write
read
Roadmap
Complete Features:
statfs
Statistics
| Type | Lines Of Code | Comments | Sum |
|---|---|---|---|
| Headers | 177 | 289 | 466 |
| Sources | 1800 | 276 | 2076 |
| Sum | 1977 | 565 | 2542 |