Stroika Library 3.0d23
 
Loading...
Searching...
No Matches
WellKnownLocations.h
Go to the documentation of this file.
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2026. All rights reserved
3 */
4#ifndef _Stroika_Foundation_IO_FileSystem_WellKnownLocations_h_
5#define _Stroika_Foundation_IO_FileSystem_WellKnownLocations_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include <filesystem>
10
12
13/**
14 * \file
15 *
16 * \note Code-Status: <a href="Code-Status.md#Beta">Beta</a>
17 *
18 * TODO:
19 * @todo Implement caching of computed well known directory locations (done add hoc in some cases)
20 *
21 * @todo Consider the utility of the 'create if not present' flag. Once considered, probably handle more
22 * uniformly.
23 *
24 * @todo Reimplement windows code with SHGetKnownFolderPath
25 * http://msdn.microsoft.com/en-us/library/windows/desktop/bb762188(v=vs.85).aspx
26 * http://msdn.microsoft.com/en-us/library/windows/desktop/dd378457(v=vs.85).aspx
27 *
28 * Existing windows code uses deprecated APIs.
29 */
30
31/**
32 * These WellKnownLocations routines always return a valid directory (if createIfNotPresent)
33 * or empty string (if not valid???).
34 *
35 * If a directory is returned, it is always terminated with filesystem::path::preferred_separator
36 * so that its unambiguously a directory name.
37 *
38 * Most of these names/concepts for pathnames come from:
39 * http://www.pathname.com/fhs/pub/fhs-2.3.html
40 * and/or
41 * http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
42 */
44
45 /**
46 */
47 filesystem::path GetMyDocuments (bool createIfNotPresent = true);
48
49 /**
50 * Returns:
51 * GetSpoolDirectory () returns the top level directory where applications store
52 * data which awaits later processing (like a mail spool or queue). This is in some sense
53 * temporary data, but data which should be preserved across boots.
54 *
55 * Data stored here is typically deleted once its been processed.
56 */
57 filesystem::path GetSpoolDirectory ();
58
59 /**
60 * Returns:
61 * Return directory which contains top-level application data - which should
62 * be persistent. Store long-term application data (which is not user specific)
63 * such as databases etc here.
64 *
65 * POSIX:
66 * /var/opt
67 * though arguably should be /var/lib - fhs-2.3.html and Filesystem_Hierarchy_Standard
68 * are pretty unclear - was /var/lib until Stroika v2.0a207
69 */
70 filesystem::path GetApplicationData (bool createIfNotPresent = true);
71
72 /**
73 * Returns:
74 * Return runtime variable data - like pid files.
75 *
76 * PID files go there. Transient UNIX-domain sockets must place them in this directory.
77 *
78 * POSIX:
79 * /var/run
80 * Windows:
81 * Alias for GetTemporary()
82 */
83 filesystem::path GetRuntimeVariableData ();
84
85 /**
86 * Returns:
87 * This returns the directory where an application may write temporary files -
88 * files which should not be preserved across reboots (though the OS may not enforce this).
89 * This directory may or may not be current-user-specific.
90 *
91 * Typically this is /tmp, or the value of %TEMP%, or $TMPDIR, or something like that.
92 *
93 * \note same as std::filesystem::temp_directory_path ();
94 */
95 filesystem::path GetTemporary ();
96
97#if qStroika_Foundation_Common_Platform_Windows
98 /**
99 * Returns:
100 * empty string if the directory doesn't exist.
101 */
102 filesystem::path GetWinSxS ();
103#endif
104
105}
106
107/*
108 ********************************************************************************
109 ***************************** Implementation Details ***************************
110 ********************************************************************************
111 */
112#include "WellKnownLocations.inl"
113
114#endif /*_Stroika_Foundation_IO_FileSystem_WellKnownLocations_h_*/
filesystem::path GetApplicationData(bool createIfNotPresent=true)