WinRT: added platform-specific APIs to access common, writable folder paths
This commit is contained in:
parent
1fcdc86757
commit
61cc1f3aa4
3 changed files with 92 additions and 0 deletions
|
@ -53,6 +53,14 @@
|
||||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
|
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
|
||||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
|
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\core\windowsrt\SDL_winrtpaths.cpp">
|
||||||
|
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
|
||||||
|
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
|
||||||
|
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
|
||||||
|
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
|
||||||
|
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
|
||||||
|
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\core\windows\SDL_windows.c" />
|
<ClCompile Include="..\..\src\core\windows\SDL_windows.c" />
|
||||||
<ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c" />
|
<ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c" />
|
||||||
<ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
|
<ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
|
||||||
|
|
|
@ -93,6 +93,45 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath();
|
||||||
#endif /* __ANDROID__ */
|
#endif /* __ANDROID__ */
|
||||||
|
|
||||||
|
|
||||||
|
/* Platform specific functions for Windows RT */
|
||||||
|
#if defined(__WINRT__) && __WINRT__
|
||||||
|
|
||||||
|
/* Gets the path to the local app data store.
|
||||||
|
Files and directories that should be limited to the local device can be
|
||||||
|
created in this path.
|
||||||
|
|
||||||
|
This function may be used safely on Windows Phone 8, as opposed to
|
||||||
|
SDL_WinRTGetRoamingFolderPath() and SDL_WinRTGetTemporaryFolderPath(),
|
||||||
|
which do not work on Windows Phone 8 (and will return NULL if called
|
||||||
|
from this platform).
|
||||||
|
*/
|
||||||
|
extern DECLSPEC const char * SDLCALL SDL_WinRTGetLocalFolderPath();
|
||||||
|
|
||||||
|
/* Gets the path to the roaming app data store.
|
||||||
|
Files and directories that should roam to different devices can be
|
||||||
|
created in this path. Be sure to read Microsoft's documentation on
|
||||||
|
roaming files for more information on how this works, as restrictions
|
||||||
|
do apply.
|
||||||
|
|
||||||
|
Please note that on Windows Phone 8, this function will return NULL,
|
||||||
|
as Windows Phone 8 apps do not have an accessible roaming app data
|
||||||
|
store.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC const char * SDLCALL SDL_WinRTGetRoamingFolderPath();
|
||||||
|
|
||||||
|
/* Gets the path to the temporary app data store.
|
||||||
|
Files and directories may be written here, however they may be deleted
|
||||||
|
by Windows at a future date.
|
||||||
|
|
||||||
|
Please note that on Windows Phone 8, this function will return NULL,
|
||||||
|
as Windows Phone 8 apps do not have an accessible temporary app data
|
||||||
|
store.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC const char * SDLCALL SDL_WinRTGetTemporaryFolderPath();
|
||||||
|
|
||||||
|
#endif /* __WINRT__ */
|
||||||
|
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
|
|
45
src/core/windowsrt/SDL_winrtpaths.cpp
Normal file
45
src/core/windowsrt/SDL_winrtpaths.cpp
Normal file
|
@ -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__ */
|
Loading…
Add table
Add a link
Reference in a new issue