src/core/windowsrt/SDL_winrtpaths.cpp
author David Ludwig <dludwig@pobox.com>
Sun, 03 Feb 2013 13:18:31 -0500
changeset 8406 a3244b2eefcd
parent 8405 fe893b2d6f4d
child 8420 99dc85ad173c
permissions -rw-r--r--
WinRT: fixed an odd path retrieval bug
dludwig@8388
     1
/* TODO, WinRT: include copyright info in SDL_winrtpaths.cpp
dludwig@8388
     2
   TODO, WinRT: add note to SDL_winrtpaths.cpp mentioning that /ZW must be used when compiling the file
dludwig@8388
     3
*/
dludwig@8388
     4
dludwig@8388
     5
#include "SDL_config.h"
dludwig@8388
     6
dludwig@8388
     7
#ifdef __WINRT__
dludwig@8388
     8
dludwig@8388
     9
extern "C" {
dludwig@8403
    10
#include "SDL_error.h"
dludwig@8403
    11
#include "SDL_stdinc.h"
dludwig@8388
    12
#include "SDL_system.h"
dludwig@8388
    13
#include "../windows/SDL_windows.h"
dludwig@8388
    14
}
dludwig@8388
    15
dludwig@8406
    16
#include <string>
dludwig@8406
    17
dludwig@8406
    18
using namespace std;
dludwig@8388
    19
using namespace Windows::Storage;
dludwig@8388
    20
dludwig@8403
    21
extern "C" const wchar_t *
dludwig@8405
    22
SDL_WinRTGetInstalledLocationPath()
dludwig@8405
    23
{
dludwig@8406
    24
    static wstring path;
dludwig@8406
    25
    if (path.empty()) {
dludwig@8406
    26
        path = Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data();
dludwig@8405
    27
    }
dludwig@8406
    28
    return path.c_str();
dludwig@8405
    29
}
dludwig@8405
    30
dludwig@8405
    31
extern "C" const wchar_t *
dludwig@8403
    32
SDL_WinRTGetLocalFolderPath()
dludwig@8403
    33
{
dludwig@8406
    34
    static wstring path;
dludwig@8406
    35
    if (path.empty()) {
dludwig@8406
    36
        path = ApplicationData::Current->LocalFolder->Path->Data();
dludwig@8388
    37
    }
dludwig@8406
    38
    return path.c_str();
dludwig@8388
    39
}
dludwig@8388
    40
dludwig@8403
    41
extern "C" const wchar_t *
dludwig@8403
    42
SDL_WinRTGetRoamingFolderPath()
dludwig@8388
    43
{
dludwig@8404
    44
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
dludwig@8404
    45
    SDL_Unsupported();
dludwig@8404
    46
    return NULL;
dludwig@8404
    47
#else
dludwig@8406
    48
    static wstring path;
dludwig@8406
    49
    if (path.empty()) {
dludwig@8406
    50
        path = ApplicationData::Current->RoamingFolder->Path->Data();
dludwig@8388
    51
    }
dludwig@8406
    52
    return path.c_str();
dludwig@8404
    53
#endif
dludwig@8388
    54
}
dludwig@8388
    55
dludwig@8403
    56
extern "C" const wchar_t *
dludwig@8403
    57
SDL_WinRTGetTemporaryFolderPath()
dludwig@8388
    58
{
dludwig@8404
    59
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
dludwig@8404
    60
    SDL_Unsupported();
dludwig@8404
    61
    return NULL;
dludwig@8404
    62
#else
dludwig@8406
    63
    static wstring path;
dludwig@8406
    64
    if (path.empty()) {
dludwig@8406
    65
        path = ApplicationData::Current->TemporaryFolder->Path->Data();
dludwig@8388
    66
    }
dludwig@8406
    67
    return path.c_str();
dludwig@8404
    68
#endif
dludwig@8388
    69
}
dludwig@8388
    70
dludwig@8388
    71
#endif /* __WINRT__ */