mirror of https://github.com/bjornbytes/lovr.git
Config parameter for save directory precedence
This commit is contained in:
parent
c4e0ace182
commit
66d7e887c7
|
@ -303,7 +303,8 @@ static int l_lovrFilesystemRemove(lua_State* L) {
|
|||
|
||||
static int l_lovrFilesystemSetIdentity(lua_State* L) {
|
||||
const char* identity = luaL_checkstring(L, 1);
|
||||
lovrFilesystemSetIdentity(identity);
|
||||
bool precedence = lua_toboolean(L, 2);
|
||||
lovrFilesystemSetIdentity(identity, precedence);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -276,7 +276,7 @@ const char* lovrFilesystemGetIdentity() {
|
|||
return state.identity;
|
||||
}
|
||||
|
||||
bool lovrFilesystemSetIdentity(const char* identity) {
|
||||
bool lovrFilesystemSetIdentity(const char* identity, bool precedence) {
|
||||
size_t length = strlen(identity);
|
||||
|
||||
// Identity can only be set once
|
||||
|
@ -312,7 +312,7 @@ bool lovrFilesystemSetIdentity(const char* identity) {
|
|||
fs_mkdir(state.savePath);
|
||||
|
||||
// Mount the fully resolved save path
|
||||
if (!lovrFilesystemMount(state.savePath, NULL, false, NULL)) {
|
||||
if (!lovrFilesystemMount(state.savePath, NULL, !precedence, NULL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ uint64_t lovrFilesystemGetLastModified(const char* path);
|
|||
void* lovrFilesystemRead(const char* path, size_t bytes, size_t* bytesRead);
|
||||
void lovrFilesystemGetDirectoryItems(const char* path, void (*callback)(void* context, const char* path), void* context);
|
||||
const char* lovrFilesystemGetIdentity(void);
|
||||
bool lovrFilesystemSetIdentity(const char* identity);
|
||||
bool lovrFilesystemSetIdentity(const char* identity, bool precedence);
|
||||
const char* lovrFilesystemGetSaveDirectory(void);
|
||||
bool lovrFilesystemCreateDirectory(const char* path);
|
||||
bool lovrFilesystemRemove(const char* path);
|
||||
|
|
|
@ -83,6 +83,7 @@ function lovr.boot()
|
|||
local conf = {
|
||||
version = '0.13.0',
|
||||
identity = 'default',
|
||||
saveprecedence = true,
|
||||
hotkeys = true,
|
||||
modules = {
|
||||
audio = true,
|
||||
|
@ -124,7 +125,7 @@ function lovr.boot()
|
|||
if confOk and lovr.conf then confOk, confError = pcall(lovr.conf, conf) end
|
||||
|
||||
lovr._setConf(conf)
|
||||
lovr.filesystem.setIdentity(conf.identity)
|
||||
lovr.filesystem.setIdentity(conf.identity, conf.saveprecedence)
|
||||
|
||||
for module in pairs(conf.modules) do
|
||||
if conf.modules[module] then
|
||||
|
|
Loading…
Reference in New Issue