Fix initial write directory set on windows;

This commit is contained in:
bjorn 2017-04-28 23:58:26 -07:00
parent f9e2b1441e
commit 331c5efa49
1 changed files with 3 additions and 5 deletions

View File

@ -127,7 +127,7 @@ const char* lovrFilesystemGetSaveDirectory() {
int lovrFilesystemGetSize(const char* path) {
PHYSFS_file* handle = PHYSFS_openRead(path);
if (!handle) {
return 1;
return -1;
}
int length = PHYSFS_fileLength(handle);
@ -210,12 +210,10 @@ int lovrFilesystemSetIdentity(const char* identity) {
}
}
const char* sep = PHYSFS_getDirSeparator();
lovrFilesystemGetAppdataDirectory(state.savePathFull, LOVR_PATH_MAX);
PHYSFS_setWriteDir(state.savePathFull);
snprintf(state.savePathRelative, LOVR_PATH_MAX, "LOVR%s%s", sep, identity);
snprintf(state.savePathFull, LOVR_PATH_MAX, "%s%s%s", state.savePathFull, sep, state.savePathRelative);
snprintf(state.savePathRelative, LOVR_PATH_MAX, "LOVR/%s", identity);
snprintf(state.savePathFull, LOVR_PATH_MAX, "%s/%s", state.savePathFull, state.savePathRelative);
PHYSFS_mkdir(state.savePathRelative);
if (!PHYSFS_setWriteDir(state.savePathFull)) {
error("Could not set write directory");