Stroika Library
3.0d16
Help-Home
Loading...
Searching...
No Matches
WellKnownLocations.h
Go to the documentation of this file.
1
/*
2
* Copyright(c) Sophist Solutions, Inc. 1990-2025. 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
11
#include "
Stroika/Foundation/Characters/String.h
"
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
#if 0
32
namespace
Stroika::Foundation::IO::FileSystem
{
33
using
Characters::SDKString
;
34
using
Characters::String;
35
}
36
#endif
37
38
/**
39
* These WellKnownLocations routines always return a valid directory (if createIfNotPresent)
40
* or empty string (if not valid???).
41
*
42
* If a directory is returned, it is always terminated with filesystem::path::preferred_separator
43
* so that its unambiguously a directory name.
44
*
45
* Most of these names/concepts for pathnames come from:
46
* http://www.pathname.com/fhs/pub/fhs-2.3.html
47
* and/or
48
* http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
49
*/
50
namespace
Stroika::Foundation::IO::FileSystem::WellKnownLocations
{
51
52
/**
53
*/
54
filesystem::path GetMyDocuments (
bool
createIfNotPresent =
true
);
55
56
/**
57
* Returns:
58
* GetSpoolDirectory () returns the top level directory where applications store
59
* data which awaits later processing (like a mail spool or queue). This is in some sense
60
* temporary data, but data which should be preserved across boots.
61
*
62
* Data stored here is typically deleted once its been processed.
63
*/
64
filesystem::path
GetSpoolDirectory
();
65
66
/**
67
* Returns:
68
* Return directory which contains top-level application data - which should
69
* be persistent. Store long-term application data (which is not user specific)
70
* such as databases etc here.
71
*
72
* POSIX:
73
* /var/opt
74
* though arguably should be /var/lib - fhs-2.3.html and Filesystem_Hierarchy_Standard
75
* are pretty unclear - was /var/lib until Stroika v2.0a207
76
*/
77
filesystem::path
GetApplicationData
(
bool
createIfNotPresent =
true
);
78
79
/**
80
* Returns:
81
* Return runtime variable data - like pid files.
82
*
83
* PID files go there. Transient UNIX-domain sockets must place them in this directory.
84
*
85
* POSIX:
86
* /var/run
87
* Windows:
88
* Alias for GetTemporary()
89
*/
90
filesystem::path
GetRuntimeVariableData
();
91
92
/**
93
* Returns:
94
* This returns the directory where an application may write temporary files -
95
* files which should not be preserved across reboots (though the OS may not enforce this).
96
* This directory may or may not be current-user-specific.
97
*
98
* Typically this is /tmp, or the value of %TEMP%, or $TMPDIR, or something like that.
99
*/
100
filesystem::path
GetTemporary
();
101
102
#if qStroika_Foundation_Common_Platform_Windows
103
/**
104
* Returns:
105
* empty string if the directory doesn't exist.
106
*/
107
filesystem::path GetWinSxS ();
108
#endif
109
110
}
111
112
/*
113
********************************************************************************
114
***************************** Implementation Details ***************************
115
********************************************************************************
116
*/
117
118
#endif
/*_Stroika_Foundation_IO_FileSystem_WellKnownLocations_h_*/
String.h
Stroika::Foundation::Characters::SDKString
basic_string< SDKChar > SDKString
Definition
SDKString.h:38
Stroika::Foundation::IO::FileSystem::WellKnownLocations
Definition
WellKnownLocations.h:50
Stroika::Foundation::IO::FileSystem::WellKnownLocations::GetTemporary
filesystem::path GetTemporary()
Definition
WellKnownLocations.cpp:221
Stroika::Foundation::IO::FileSystem::WellKnownLocations::GetSpoolDirectory
filesystem::path GetSpoolDirectory()
Definition
WellKnownLocations.cpp:76
Stroika::Foundation::IO::FileSystem::WellKnownLocations::GetApplicationData
filesystem::path GetApplicationData(bool createIfNotPresent=true)
Definition
WellKnownLocations.cpp:107
Stroika::Foundation::IO::FileSystem::WellKnownLocations::GetRuntimeVariableData
filesystem::path GetRuntimeVariableData()
Definition
WellKnownLocations.cpp:134
Stroika::Foundation::IO::FileSystem
Definition
Foundation/IO/FileSystem/Common.h:18
Library
Sources
Stroika
Foundation
IO
FileSystem
WellKnownLocations.h
Generated by
1.9.8