On 2016-09-11 11:19, Jens Åkerblom wrote:
> Hello there,
>
> I've been looking through the proposed C++17 Filesystem library and thought
> it would be a nice add-on to have common paths. The only path I see that is
> already present is the *std::filesystem::temp_directory_path*. The
> directories of interest (as I see) would be
>
> - *executable_directory_path*, *installed_directory_path* or maybe a
> better name, *bundle_directory_path*, directory where the executable is
> being run / has been installed. Assumed to be read-only.
I don't think you can implement this without platform support. That
support *might* already be available on common platforms, but then again
it might not.
Implementing it for example on Linux requires digging around in /proc.
Specifically, you need something like
https://github.com/gpakosz/whereami.
> - *userdata_directory_path*, directory where current user stores data,
> "My Documents" on Windows for example. Assume permission required to write
> and read.
> - *cache_directory_path*, directory to data that persists longer than in
> *temp_diretory_path*, can be removed by OS if deemed necessary.
> "Library/Cache" on iOS for example. Assume write and read permission.
> - *appdata_directory_path*, directory where the application can store
> persistent data not to be shared with other application.
> "/data/data/<package_name>" on Android for example. Assume write and read
> permissions.
These may be simplifications. I would compare with existing prior art,
e.g.
http://doc.qt.io/qt-5/qstandardpaths.html.
--
Matthew