Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scivision/ffilesystem-concepts
A testbed for our Ffilesystem library, to test techniques across platforms first.
https://github.com/scivision/ffilesystem-concepts
cpp17 path-manipulation
Last synced: 14 days ago
JSON representation
A testbed for our Ffilesystem library, to test techniques across platforms first.
- Host: GitHub
- URL: https://github.com/scivision/ffilesystem-concepts
- Owner: scivision
- License: mit
- Created: 2023-03-19T15:33:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-01T05:22:40.000Z (7 months ago)
- Last Synced: 2024-05-02T03:08:30.275Z (7 months ago)
- Topics: cpp17, path-manipulation
- Language: C++
- Homepage: https://github.com/scivision/fortran-filesystem
- Size: 168 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Filesystem concepts
A testbed for the
[Ffilesystem library](https://github.com/scivision/fortran-filesystem),
to test across platforms without breaking the widely-used library.
As in Ffilesystem, we use some optional C++20 features.
The main focus is on the C++17
[filesystem](https://en.cppreference.com/w/cpp/filesystem)
standard library.
We also demonstrate techniques in C to reproduce some C++ filesystem functionality at lower fidelity--otherwise, we'd be reinventing the wheel.## platform-independent mkdtemp()
Platform-independent
[mkdtemp()](./test/mkdtemp/)
is a C++17 example of creating a temporary directory that works on Windows, Linux, macOS, MinGW, Cygwin, WSL, etc. across compilers and operating systems.## Canonical
Creating [canonical](./test/canonical/) "Lname" as entirely the lower case version of "Uname" deliberately forces the drive/root to be lower case.
In general full paths on Windows and macOS have some uppercase character elements:* Windows: upper case drive letter
* macOS: /Users/ etc. has some upper case letters## Copy file tree
Recursively [copy a file tree](./test/copytree/).
## Iterate over directory
[Example](./test/iterdir/) of iterating over directory contents.
## Is executable
[Is executable](./test/is_exe/) tests if a file is executable. On Windows filesystems such as NTFS, all files are always seen as executable.
On most other filesystems, executable permissions can be detected.## file types
Show what [type a file](./test/file_types/) is, such as regular file, directory, symlink, etc.
## lib_dir
A working example of how to determine an executable's full path no matter what the current working directory is.
This can be useful when a data file is known to exist relative to an executable.
This is relevant to say CMake installed project that has an executable and associated data files installed.
Assuming the user knows the path to the MAIN executable in the installed directory, the program can determine its own full path and
then a priori know the relative path to the data file(s).## Drive space available
Determine the [free space available on a drive](./test/space_avail/).
## Filesystem type
Determine the
[filesystem type](./test/filesystem_type/)
of a drive or partition.
Note that WSL uses
[v9fs](https://devblogs.microsoft.com/commandline/whats-new-for-wsl-in-windows-10-version-1903/).## Windows short path
For Windows only, find the short path (8.3) from a long filename and [vice versa](./test/short_path/).
## Symbolic links
[Symbolic links](./test/symlink/) are demonstrated across platforms, including Linux, macOS, Windows, MinGW, WSL, and Cygwin.
Windows symlinks may require setting group policy (Windows Pro) or enabling Windows Developer Mode (non-Pro Windows).## Syscall
[Example system calls](./test/syscall/) with mild effort towards security and cross-platform compatibility.