This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
/
SDL_winrtpaths.cpp
71 lines (61 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
/* TODO, WinRT: include copyright info in SDL_winrtpaths.cpp
TODO, WinRT: add note to SDL_winrtpaths.cpp mentioning that /ZW must be used when compiling the file
*/
#include "SDL_config.h"
#ifdef __WINRT__
extern "C" {
10
11
#include "SDL_error.h"
#include "SDL_stdinc.h"
12
13
14
15
#include "SDL_system.h"
#include "../windows/SDL_windows.h"
}
16
#include <string>
17
18
19
using namespace std;
using namespace Windows::Storage;
20
21
22
23
extern "C" const wchar_t *
SDL_WinRTGetInstalledLocationPath()
{
24
25
26
static wstring path;
if (path.empty()) {
path = Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data();
27
}
28
return path.c_str();
29
30
}
31
32
33
extern "C" const wchar_t *
SDL_WinRTGetLocalFolderPath()
{
34
35
36
static wstring path;
if (path.empty()) {
path = ApplicationData::Current->LocalFolder->Path->Data();
37
}
38
return path.c_str();
39
40
}
41
42
extern "C" const wchar_t *
SDL_WinRTGetRoamingFolderPath()
43
{
44
45
46
47
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
SDL_Unsupported();
return NULL;
#else
48
49
50
static wstring path;
if (path.empty()) {
path = ApplicationData::Current->RoamingFolder->Path->Data();
51
}
52
return path.c_str();
53
#endif
54
55
}
56
57
extern "C" const wchar_t *
SDL_WinRTGetTemporaryFolderPath()
58
{
59
60
61
62
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
SDL_Unsupported();
return NULL;
#else
63
64
65
static wstring path;
if (path.empty()) {
path = ApplicationData::Current->TemporaryFolder->Path->Data();
66
}
67
return path.c_str();
68
#endif
69
70
71
}
#endif /* __WINRT__ */