WinRT: allowed 'roaming' and 'temp' folder paths to be retrieved on WinPhone 8.1
authorDavid Ludwig <dludwig@pobox.com>
Sun, 23 Nov 2014 08:52:10 -0500
changeset 92289ecf7c9f49e5
parent 9227 4d9126f64347
child 9229 c4ff10b9a23c
WinRT: allowed 'roaming' and 'temp' folder paths to be retrieved on WinPhone 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.
src/filesystem/winrt/SDL_sysfilesystem.cpp
     1.1 --- a/src/filesystem/winrt/SDL_sysfilesystem.cpp	Sun Nov 23 11:26:46 2014 +0100
     1.2 +++ b/src/filesystem/winrt/SDL_sysfilesystem.cpp	Sun Nov 23 08:52:10 2014 -0500
     1.3 @@ -62,7 +62,7 @@
     1.4              return path.c_str();
     1.5          }
     1.6  
     1.7 -#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
     1.8 +#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8)
     1.9          case SDL_WINRT_PATH_ROAMING_FOLDER:
    1.10          {
    1.11              static wstring path;
    1.12 @@ -145,10 +145,16 @@
    1.13       */
    1.14  
    1.15  #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
    1.16 -    /* A 'Roaming' folder is not available in Windows Phone 8, however a 'Local' folder is. */
    1.17 +    /* A 'Roaming' folder is not available in Windows Phone 8.0, however a
    1.18 +     * 'Local' folder is.  Use the 'Local' folder in order to preserve
    1.19 +     * compatibility with Windows Phone 8.0, and with app-installs that have
    1.20 +     * been updated from 8.0-based, to 8.1-based apps.
    1.21 +     */
    1.22      const char * srcPath = SDL_WinRTGetFSPathUTF8(SDL_WINRT_PATH_LOCAL_FOLDER);
    1.23  #else
    1.24 -    /* A 'Roaming' folder is available on Windows 8 and 8.1.  Use that. */
    1.25 +    /* A 'Roaming' folder is available on Windows 8 and 8.1.  Use that.
    1.26 +     * (SDL for Win32/Windows-Desktop uses the 'roaming' path as well).
    1.27 +     */
    1.28      const char * srcPath = SDL_WinRTGetFSPathUTF8(SDL_WINRT_PATH_ROAMING_FOLDER);
    1.29  #endif
    1.30