mirror of
https://github.com/etlegacy/wolfadmin.git
synced 2024-11-25 13:41:21 +00:00
Added getHomePath() function, move SQLite database to homepath
This commit is contained in:
parent
c0d2aa0e92
commit
c261a10c9f
3 changed files with 12 additions and 6 deletions
|
@ -299,7 +299,7 @@ function sqlite3.isconnected()
|
|||
end
|
||||
|
||||
function sqlite3.start()
|
||||
con = env:connect(settings.get("db_file"))
|
||||
con = env:connect(wolfa_getHomePath()..settings.get("db_file"))
|
||||
|
||||
if not con then
|
||||
return
|
||||
|
|
|
@ -45,6 +45,7 @@ local version = "1.1.0-beta"
|
|||
local release = "26 August 2016"
|
||||
|
||||
local basepath = nil
|
||||
local homepath = nil
|
||||
|
||||
-- game related data
|
||||
local currentLevelTime = nil
|
||||
|
@ -66,6 +67,10 @@ function wolfa_getBasePath()
|
|||
return basepath
|
||||
end
|
||||
|
||||
function wolfa_getHomePath()
|
||||
return homepath
|
||||
end
|
||||
|
||||
function et_InitGame(levelTime, randomSeed, restartMap)
|
||||
et.RegisterModname("WolfAdmin "..wolfa_getVersion())
|
||||
|
||||
|
@ -73,7 +78,8 @@ function et_InitGame(levelTime, randomSeed, restartMap)
|
|||
|
||||
et.trap_SendConsoleCommand(et.EXEC_APPEND, "sets mod_wolfadmin "..wolfa_getVersion()..";")
|
||||
|
||||
basepath = string.gsub(et.trap_Cvar_Get("fs_basepath"), "\\", "/").."/"..et.trap_Cvar_Get("fs_game").."/luascripts/wolfadmin/"
|
||||
basepath = string.gsub(et.trap_Cvar_Get("fs_basepath"), "\\", "/").."/"..et.trap_Cvar_Get("fs_game").."/"
|
||||
homepath = string.gsub(et.trap_Cvar_Get("fs_homepath"), "\\", "/").."/"..et.trap_Cvar_Get("fs_game").."/"
|
||||
|
||||
if not (et.trap_Cvar_Get("fs_game") == "noquarter" or et.trap_Cvar_Get("fs_game") == "nq") then
|
||||
outputDebug("Warning! Not running NoQuarter, this may cause bugs. Use at your own risk.")
|
||||
|
|
|
@ -25,11 +25,11 @@ function files.ls(directory)
|
|||
local entries = {}
|
||||
|
||||
if platform == "unix" then
|
||||
command = 'ls -1 "'..wolfa_getBasePath()..directory..'"'
|
||||
command = 'ls -1 "'..wolfa_getBasePath()..'luascripts/wolfadmin/'..directory..'"'
|
||||
elseif platform == "windows" then
|
||||
command = 'dir "'..wolfa_getBasePath()..directory..'" /b'
|
||||
command = 'dir "'..wolfa_getBasePath()..'luascripts/wolfadmin/'..directory..'" /b'
|
||||
end
|
||||
|
||||
|
||||
for filename in io.popen(command):lines() do
|
||||
table.insert(entries, filename)
|
||||
end
|
||||
|
@ -133,4 +133,4 @@ function files.save(fileName, array)
|
|||
return true
|
||||
end
|
||||
|
||||
return files
|
||||
return files
|
||||
|
|
Loading…
Reference in a new issue