Skip to content

Commit

Permalink
WinRT: allowed 'roaming' and 'temp' folder paths to be retrieved on W…
Browse files Browse the repository at this point in the history
…inPhone 8.1

Windows Phone 8.0 either did not define, or provide access to, a 'RoamingFolder'
or 'TemporaryFolder' for apps to use.  Windows 8.0 and 8.1 do, as does
Windows Phone 8.1.  This change allows SDL-based Windows Phone 8.1 apps to
access these folders, via either the SDL_WinRTGetFSPathUNICODE() or
SDL_WinRTGetFSPathUTF8() functions.

SDL_GetPrefPath(), which on WinRT, is based on SDL_WinRTGetFSPathUTF8(), will
continue to return the app's 'local' folder, despite Windows 8.x
counterpart apps using the 'roaming' folder, in order to preserve compatibility
when 8.0-based Phone apps upgrade to 8.1-based Phone apps.
  • Loading branch information
DavidLudwig committed Nov 23, 2014
1 parent a690944 commit 13c5116
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/filesystem/winrt/SDL_sysfilesystem.cpp
Expand Up @@ -62,7 +62,7 @@ SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType)
return path.c_str();
}

#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8)
case SDL_WINRT_PATH_ROAMING_FOLDER:
{
static wstring path;
Expand Down Expand Up @@ -145,10 +145,16 @@ SDL_GetPrefPath(const char *org, const char *app)
*/

#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
/* A 'Roaming' folder is not available in Windows Phone 8, however a 'Local' folder is. */
/* A 'Roaming' folder is not available in Windows Phone 8.0, however a
* 'Local' folder is. Use the 'Local' folder in order to preserve
* compatibility with Windows Phone 8.0, and with app-installs that have
* been updated from 8.0-based, to 8.1-based apps.
*/
const char * srcPath = SDL_WinRTGetFSPathUTF8(SDL_WINRT_PATH_LOCAL_FOLDER);
#else
/* A 'Roaming' folder is available on Windows 8 and 8.1. Use that. */
/* A 'Roaming' folder is available on Windows 8 and 8.1. Use that.
* (SDL for Win32/Windows-Desktop uses the 'roaming' path as well).
*/
const char * srcPath = SDL_WinRTGetFSPathUTF8(SDL_WINRT_PATH_ROAMING_FOLDER);
#endif

Expand Down

0 comments on commit 13c5116

Please sign in to comment.