Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
72 lines (63 loc) · 1.72 KB

SDL_winrtpaths.cpp

File metadata and controls

72 lines (63 loc) · 1.72 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" {
Feb 3, 2013
Feb 3, 2013
10
11
#include "SDL_error.h"
#include "SDL_stdinc.h"
12
13
14
15
16
17
#include "SDL_system.h"
#include "../windows/SDL_windows.h"
}
using namespace Windows::Storage;
Feb 3, 2013
Feb 3, 2013
18
19
static const wchar_t *
WINRT_CopySystemPath(Windows::Storage::StorageFolder ^ folder)
Feb 3, 2013
Feb 3, 2013
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const wchar_t * srcPath = folder->Path->Data();
const size_t srcPathLen = SDL_wcslen(srcPath);
wchar_t * destPath = (wchar_t *) SDL_calloc(srcPathLen + 1, sizeof(wchar_t));
if (!destPath) {
SDL_OutOfMemory();
return NULL;
}
SDL_wcslcpy(destPath, srcPath, srcPathLen + 1);
return destPath;
}
extern "C" const wchar_t *
SDL_WinRTGetLocalFolderPath()
{
static const wchar_t * path = nullptr;
Feb 3, 2013
Feb 3, 2013
37
path = WINRT_CopySystemPath(ApplicationData::Current->LocalFolder);
38
39
40
41
}
return path;
}
Feb 3, 2013
Feb 3, 2013
42
43
extern "C" const wchar_t *
SDL_WinRTGetRoamingFolderPath()
Feb 3, 2013
Feb 3, 2013
45
46
47
48
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
SDL_Unsupported();
return NULL;
#else
Feb 3, 2013
Feb 3, 2013
49
static const wchar_t * path = nullptr;
Feb 3, 2013
Feb 3, 2013
51
path = WINRT_CopySystemPath(ApplicationData::Current->RoamingFolder);
Feb 3, 2013
Feb 3, 2013
54
#endif
Feb 3, 2013
Feb 3, 2013
57
58
extern "C" const wchar_t *
SDL_WinRTGetTemporaryFolderPath()
Feb 3, 2013
Feb 3, 2013
60
61
62
63
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
SDL_Unsupported();
return NULL;
#else
Feb 3, 2013
Feb 3, 2013
64
static const wchar_t * path = nullptr;
Feb 3, 2013
Feb 3, 2013
66
path = WINRT_CopySystemPath(ApplicationData::Current->TemporaryFolder);
Feb 3, 2013
Feb 3, 2013
69
#endif
70
71
72
}
#endif /* __WINRT__ */