Skip to content

Emulator of 'std::filesystem' usable with g++11 without additional libraries

License

Notifications You must be signed in to change notification settings

p-hofmann/Cpp-FileSystem-Emulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cpp-FileSystem-Emulator

TraviCI CircleCI
Emulates '<experimental/filesystem>' without the need for g++17. It is usable with g++11 without additional libraries

  • Early version: Not all methods are implemented since they are coded as they are needed.
  • Additional methods are available, such as force_absolute_path().
  • Compatible with Linux, Windows OS and Apple(Darwin).
  • Continuous integration: Travis CI, Circle CI.

Noteworthy methods

All methods are compatible with Linux, Windows OS and Apple(Darwin).

filesystem::path::force_absolute_path()

This methods forces an absolute path from a given file or folder path.
Given a relative path, the current working directory is added, except in case there is an executable found in the system path. In such a case the system path is added. Using Windows OS, the extension '.exe' might be added if an executable(.exe) file was found in the system path. Note however, that an extension will not be looked for in any other case! If a local relative directory/file and a system path file fit a given relative path, the local path is given priority.
A file or folder does not need to exist for a path to get transformed into a full path, it only effects priority.
Priority: Existing local path > System path > Local path

filesystem::get_environment_variable(your_variable)

Resolves a environment variable and returns it as string.

filesystem::current_path()

Get the current working directory!

Project Layout

├── CMakeLists.txt
├── .travis.yml
├── include
│      └── filesystem.h
├── src
│      ├── filesystem_LINUX.cpp
│      ├── filesystem_WIN32.cpp
├── external
│      └── catch2
│               └── catch.hpp
└── tests
        ├── CMakeLists.txt
        ├── test_filesystem_LINUX.cpp
        └── test_filesystem_WIN32.cpp
        ├── test_filesystem_DARWIN.cpp

  • Catch2 will be downloaded as part of cmake when run on unittests

TODO

  • Valgrind test in Windows OS
  • Recreate missing methods from original filesystem
  • UTF-8 support for paths

About

Emulator of 'std::filesystem' usable with g++11 without additional libraries

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published