4#include "Stroika/Foundation/StroikaPreComp.h"
6#if qStroika_Foundation_Common_Platform_Windows
13#include "Stroika/Foundation/Execution/Throw.h"
14#if qStroika_Foundation_Common_Platform_Windows
15#include "Stroika/Foundation/Execution/Platform/Windows/Exception.h"
24using namespace Stroika::Foundation::IO;
35filesystem::path FileSystem::WellKnownLocations::GetMyDocuments (
bool createIfNotPresent)
37#if qStroika_Foundation_Common_Platform_POSIX
43 static const filesystem::path kCachedResult_ = [] () -> filesystem::path {
45 const char* pPath = ::getenv (
"HOME");
46 if (pPath !=
nullptr) {
49 return filesystem::path{};
51 return kCachedResult_;
52#elif qStroika_Foundation_Common_Platform_Windows
58 filesystem::path result = fileBuf;
60 if (result.empty ()) {
61 result = filesystem::path{
"c:"sv};
63 Ensure (not createIfNotPresent or filesystem::is_directory (result));
67 return filesystem::path{};
78#if qStroika_Foundation_Common_Platform_POSIX
79 static const filesystem::path kVarSpool_{
"/var/spool/"sv};
81#elif qStroika_Foundation_Common_Platform_Windows
84 Verify (::SHGetSpecialFolderPath (
nullptr, fileBuf, CSIDL_COMMON_APPDATA,
false));
85 filesystem::path result = fileBuf;
87 if (result.empty ()) {
88 result = filesystem::path{
"c:"sv};
90 if (filesystem::is_directory (filesystem::path (result))) {
91 return filesystem::path (result);
94 return filesystem::path{};
109#if qStroika_Foundation_Common_Platform_POSIX
111 static const filesystem::path kVarLib_{
"/var/opt/"sv};
113#elif qStroika_Foundation_Common_Platform_Windows
115 Verify (::SHGetSpecialFolderPath (
nullptr, fileBuf, CSIDL_COMMON_APPDATA, createIfNotPresent));
116 filesystem::path result = fileBuf;
118 if (result.empty ()) {
119 result = filesystem::path{
"c:"sv};
121 Ensure (not createIfNotPresent or filesystem::is_directory (result));
136#if qStroika_Foundation_Common_Platform_POSIX
137 static const filesystem::path kResult_{
"/var/run/"sv};
139#elif qStroika_Foundation_Common_Platform_Windows
147#if qStroika_Foundation_Common_Platform_Windows
153filesystem::path FileSystem::WellKnownLocations::GetWinSxS ()
156 Verify (::SHGetSpecialFolderPathW (
nullptr, fileBuf, CSIDL_WINDOWS,
false));
157 filesystem::path result = fileBuf;
159 if (result.empty ()) {
162 result /=
"WinSxS"sv;
163 if (not filesystem::is_directory (result)) {
166 Ensure (result.empty () or filesystem::is_directory (result));
#define AssertNotImplemented()
#define qStroika_ATTRIBUTE_INDETERMINATE
qStroika_ATTRIBUTE_INDETERMINATE is used where you would use a C++ attribute for a variable that is i...
String is like std::u32string, except it is much easier to use, often much more space efficient,...
conditional_t< qTargetPlatformSDKUseswchar_t, wchar_t, char > SDKChar
basic_string< SDKChar > SDKString
filesystem::path GetTemporary()
filesystem::path GetSpoolDirectory()
filesystem::path GetApplicationData(bool createIfNotPresent=true)
filesystem::path GetRuntimeVariableData()