WinRT: added a function to retrieve the root path to the installed app

This commit is contained in:
David Ludwig 2013-02-03 12:49:12 -05:00
parent 1be3dc9512
commit e3d03f99fd
2 changed files with 16 additions and 0 deletions

View file

@ -96,6 +96,12 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath();
/* Platform specific functions for Windows RT */ /* Platform specific functions for Windows RT */
#if defined(__WINRT__) && __WINRT__ #if defined(__WINRT__) && __WINRT__
/* Gets the path to the installed app's root directory.
This function may be used safely on Windows Phone 8.
*/
extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetInstalledLocationPath();
/* Gets the path to the local app data store. /* Gets the path to the local app data store.
Files and directories that should be limited to the local device can be Files and directories that should be limited to the local device can be
created in this path. created in this path.

View file

@ -29,6 +29,16 @@ WINRT_CopySystemPath(Windows::Storage::StorageFolder ^ folder)
return destPath; return destPath;
} }
extern "C" const wchar_t *
SDL_WinRTGetInstalledLocationPath()
{
static const wchar_t * path = nullptr;
if (!path) {
path = WINRT_CopySystemPath(Windows::ApplicationModel::Package::Current->InstalledLocation);
}
return path;
}
extern "C" const wchar_t * extern "C" const wchar_t *
SDL_WinRTGetLocalFolderPath() SDL_WinRTGetLocalFolderPath()
{ {