#include "../../SDL_internal.h"
#ifdef SDL_FILESYSTEM_VITA
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <psp2/io/stat.h>
#include <sys/types.h>
#include <limits.h>
#include <fcntl.h>
#include "SDL_error.h"
#include "SDL_stdinc.h"
#include "SDL_filesystem.h"
#include "SDL_rwops.h"
char *
SDL_GetBasePath(void)
{
const char *basepath = "app0:/";
char *retval = SDL_strdup(basepath);
return retval;
}
char *
SDL_GetPrefPath(const char *org, const char *app)
{
const char *envr = "ux0:/data/";
char *retval = NULL;
char *ptr = NULL;
size_t len = 0;
if (!app) {
SDL_InvalidParamError("app");
return NULL;
}
if (!org) {
org = "";
}
len = SDL_strlen(envr);
len += SDL_strlen(org) + SDL_strlen(app) + 3;
retval = (char *) SDL_malloc(len);
if (!retval) {
SDL_OutOfMemory();
return NULL;
}
if (*org) {
SDL_snprintf(retval, len, "%s%s/%s/", envr, org, app);
} else {
SDL_snprintf(retval, len, "%s%s/", envr, app);
}
for (ptr = retval+1; *ptr; ptr++) {
if (*ptr == '/') {
*ptr = '\0';
sceIoMkdir(retval, 0777);
*ptr = '/';
}
}
sceIoMkdir(retval, 0777);
return retval;
}
#endif