Slight update to lovrDirSep;

Macro instead of global variable.
This commit is contained in:
bjorn 2019-12-29 10:30:26 -08:00
parent 79fd5ad7d8
commit 12fcaffc3b
3 changed files with 8 additions and 10 deletions

View File

@ -7,12 +7,6 @@
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
const char lovrDirSep = '\\';
#else
const char lovrDirSep = '/';
#endif
void* luax_readfile(const char* filename, size_t* bytesRead) {
return lovrFilesystemRead(filename, -1, bytesRead);
}
@ -434,7 +428,7 @@ static int libLoader(lua_State* L) {
luaL_Buffer buffer;
luaL_buffinit(L, &buffer);
luaL_addstring(&buffer, lovrFilesystemGetRealDirectory(filename));
luaL_addchar(&buffer, lovrDirSep);
luaL_addchar(&buffer, LOVR_PATH_SEP);
luaL_addstring(&buffer, filename);
luaL_pushresult(&buffer);
@ -461,7 +455,7 @@ static int libLoader(lua_State* L) {
}
} else if (*p == '?') {
for (const char* m = module; n && *m; n--, m++) {
*f++ = *m == '.' ? lovrDirSep : *m;
*f++ = *m == '.' ? LOVR_PATH_SEP : *m;
}
p++;

View File

@ -6,7 +6,11 @@
#define LOVR_PATH_MAX 1024
extern const char lovrDirSep;
#ifdef _WIN32
#define LOVR_PATH_SEP '\\'
#else
#define LOVR_PATH_SEP '/'
#endif
bool lovrFilesystemInit(const char* argExe, const char* argGame, const char* argRoot);
void lovrFilesystemDestroy(void);

View File

@ -107,7 +107,7 @@ static bool openvr_init(float offset, uint32_t msaa) {
}
char path[LOVR_PATH_MAX];
snprintf(path, sizeof(path), "%s%cactions.json", lovrFilesystemGetSaveDirectory(), lovrDirSep);
snprintf(path, sizeof(path), "%s%cactions.json", lovrFilesystemGetSaveDirectory(), LOVR_PATH_SEP);
state.input->SetActionManifestPath(path);
state.input->GetActionSetHandle("/actions/lovr", &state.actionSet);