src/filesystem/winrt/SDL_sysfilesystem.cpp
changeset 9242 f4d353bd5d16
parent 9241 4900e838abbc
child 9247 eddb899239fe
equal deleted inserted replaced
9241:4900e838abbc 9242:f4d353bd5d16
    26 #ifdef __WINRT__
    26 #ifdef __WINRT__
    27 
    27 
    28 extern "C" {
    28 extern "C" {
    29 #include "SDL_filesystem.h"
    29 #include "SDL_filesystem.h"
    30 #include "SDL_error.h"
    30 #include "SDL_error.h"
       
    31 #include "SDL_hints.h"
    31 #include "SDL_stdinc.h"
    32 #include "SDL_stdinc.h"
    32 #include "SDL_system.h"
    33 #include "SDL_system.h"
    33 #include "../../core/windows/SDL_windows.h"
    34 #include "../../core/windows/SDL_windows.h"
    34 }
    35 }
    35 
    36 
   147     /* A 'Roaming' folder is not available in Windows Phone 8.0, however a
   148     /* A 'Roaming' folder is not available in Windows Phone 8.0, however a
   148      * 'Local' folder is.  Use the 'Local' folder in order to preserve
   149      * 'Local' folder is.  Use the 'Local' folder in order to preserve
   149      * compatibility with Windows Phone 8.0, and with app-installs that have
   150      * compatibility with Windows Phone 8.0, and with app-installs that have
   150      * been updated from 8.0-based, to 8.1-based apps.
   151      * been updated from 8.0-based, to 8.1-based apps.
   151      */
   152      */
   152     const char * srcPath = SDL_WinRTGetFSPathUTF8(SDL_WINRT_PATH_LOCAL_FOLDER);
   153     SDL_WinRT_Path pathType = SDL_WINRT_PATH_LOCAL_FOLDER;
   153 #else
   154 #else
   154     /* A 'Roaming' folder is available on Windows 8 and 8.1.  Use that.
   155     /* A 'Roaming' folder is available on Windows 8 and 8.1.  Use that.
   155      */
   156      */
   156     const char * srcPath = SDL_WinRTGetFSPathUTF8(SDL_WINRT_PATH_ROAMING_FOLDER);
   157     SDL_WinRT_Path pathType = SDL_WINRT_PATH_ROAMING_FOLDER;
   157 #endif
   158 #endif
   158 
   159 
       
   160     const char * hint = SDL_GetHint(SDL_HINT_WINRT_PREF_PATH_ROOT);
       
   161     if (hint) {
       
   162         if (SDL_strcasecmp(hint, "local") == 0) {
       
   163             pathType = SDL_WINRT_PATH_LOCAL_FOLDER;
       
   164         }
       
   165 #if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8)
       
   166         else if (SDL_strcasecmp(hint, "roaming") == 0) {
       
   167             pathType = SDL_WINRT_PATH_ROAMING_FOLDER;
       
   168         }
       
   169 #endif
       
   170     }
       
   171 
       
   172     const char * srcPath = SDL_WinRTGetFSPathUTF8(pathType);
   159     size_t destPathLen;
   173     size_t destPathLen;
   160     char * destPath = NULL;
   174     char * destPath = NULL;
   161 
   175 
   162     if (!srcPath) {
   176     if (!srcPath) {
   163         SDL_SetError("Couldn't locate our basepath: %s", SDL_GetError());
   177         SDL_SetError("Couldn't locate our basepath: %s", SDL_GetError());