From b90f8438d066d68cebbfe5506b6728c76c0ba257 Mon Sep 17 00:00:00 2001 From: David Ludwig Date: Sun, 3 Feb 2013 12:49:12 -0500 Subject: [PATCH] WinRT: added a function to retrieve the root path to the installed app --- include/SDL_system.h | 6 ++++++ src/core/windowsrt/SDL_winrtpaths.cpp | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/SDL_system.h b/include/SDL_system.h index 9cc1ab80d..b7de4ab8a 100644 --- a/include/SDL_system.h +++ b/include/SDL_system.h @@ -96,6 +96,12 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(); /* Platform specific functions for Windows RT */ #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. Files and directories that should be limited to the local device can be created in this path. diff --git a/src/core/windowsrt/SDL_winrtpaths.cpp b/src/core/windowsrt/SDL_winrtpaths.cpp index 01f3c371a..19ed1d303 100644 --- a/src/core/windowsrt/SDL_winrtpaths.cpp +++ b/src/core/windowsrt/SDL_winrtpaths.cpp @@ -29,6 +29,16 @@ WINRT_CopySystemPath(Windows::Storage::StorageFolder ^ folder) 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 * SDL_WinRTGetLocalFolderPath() {