21 #include "../../SDL_internal.h"
34 #include "../../core/windows/SDL_windows.h"
38 #include <unordered_map>
41 using namespace Windows::Storage;
43 extern "C" const wchar_t *
47 case SDL_WINRT_PATH_INSTALLED_LOCATION:
51 #if defined(NTDDI_WIN10_19H1) && (NTDDI_VERSION >= NTDDI_WIN10_19H1) && (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP)
53 if (Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(
"Windows.Foundation.UniversalApiContract", 8, 0)) {
54 path = Windows::ApplicationModel::Package::Current->EffectiveLocation->Path->Data();
56 path = Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data();
59 path = Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data();
65 case SDL_WINRT_PATH_LOCAL_FOLDER:
69 path = ApplicationData::Current->LocalFolder->Path->Data();
74 #if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8)
75 case SDL_WINRT_PATH_ROAMING_FOLDER:
79 path = ApplicationData::Current->RoamingFolder->Path->Data();
84 case SDL_WINRT_PATH_TEMP_FOLDER:
88 path = ApplicationData::Current->TemporaryFolder->Path->Data();
102 extern "C" const char *
105 typedef unordered_map<SDL_WinRT_Path, string> UTF8PathMap;
106 static UTF8PathMap utf8Paths;
108 UTF8PathMap::iterator searchResult = utf8Paths.find(pathType);
109 if (searchResult != utf8Paths.end()) {
110 return searchResult->second.c_str();
119 utf8Paths[pathType] = utf8Path;
121 return utf8Paths[pathType].c_str();
129 char * destPath =
NULL;
157 WCHAR
path[MAX_PATH];
161 size_t new_wpath_len = 0;
162 BOOL api_result =
FALSE;
199 if ((new_wpath_len + 1) > MAX_PATH) {
212 api_result = CreateDirectoryW(
path,
NULL);
213 if (api_result ==
FALSE) {
214 if (GetLastError() != ERROR_ALREADY_EXISTS) {
225 api_result = CreateDirectoryW(
path,
NULL);
226 if (api_result ==
FALSE) {
227 if (GetLastError() != ERROR_ALREADY_EXISTS) {
#define SDL_WinRTGetFSPathUNICODE
#define SDL_WinRTGetFSPathUTF8
#define SDL_OutOfMemory()
#define SDL_Unsupported()
#define SDL_InvalidParamError(param)
Include file for filesystem SDL API functions.
char * SDL_GetBasePath(void)
Get the path where the application resides.
GLsizei const GLchar *const * path
#define SDL_arraysize(array)
#define WIN_UTF8ToString(S)
#define WIN_StringToUTF8(S)
int WIN_SetError(const char *prefix)