This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WinRT: added platform-specific APIs to access common, writable folder…
… paths
- Loading branch information
1 parent
53d5663
commit 97d2e1f
Showing
3 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* 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" { | ||
#include "SDL_system.h" | ||
#include "../windows/SDL_windows.h" | ||
} | ||
|
||
using namespace Windows::Storage; | ||
|
||
extern "C" const char * SDL_WinRTGetLocalFolderPath() | ||
{ | ||
static const char * path = nullptr; | ||
if (!path) { | ||
path = WIN_StringToUTF8(ApplicationData::Current->LocalFolder->Path->Data()); | ||
} | ||
return path; | ||
} | ||
|
||
extern "C" const char * SDL_WinRTGetRoamingFolderPath() | ||
{ | ||
// TODO, WinRT: make SDL_WinRTGetRoamingFolderPath return NULL on Windows Phone 8 | ||
static const char * path = nullptr; | ||
if (!path) { | ||
path = WIN_StringToUTF8(ApplicationData::Current->RoamingFolder->Path->Data()); | ||
} | ||
return path; | ||
} | ||
|
||
extern "C" const char * SDL_WinRTGetTemporaryFolderPath() | ||
{ | ||
// TODO, WinRT: make SDL_WinRTGetTemporaryFolderPath return NULL on Windows Phone 8 | ||
static const char * path = nullptr; | ||
if (!path) { | ||
path = WIN_StringToUTF8(ApplicationData::Current->TemporaryFolder->Path->Data()); | ||
} | ||
return path; | ||
} | ||
|
||
#endif /* __WINRT__ */ |