mirror of
https://github.com/etlegacy/wolfadmin.git
synced 2024-11-29 07:21:54 +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
|
end
|
||||||
|
|
||||||
function sqlite3.start()
|
function sqlite3.start()
|
||||||
con = env:connect(settings.get("db_file"))
|
con = env:connect(wolfa_getHomePath()..settings.get("db_file"))
|
||||||
|
|
||||||
if not con then
|
if not con then
|
||||||
return
|
return
|
||||||
|
|
|
@ -45,6 +45,7 @@ local version = "1.1.0-beta"
|
||||||
local release = "26 August 2016"
|
local release = "26 August 2016"
|
||||||
|
|
||||||
local basepath = nil
|
local basepath = nil
|
||||||
|
local homepath = nil
|
||||||
|
|
||||||
-- game related data
|
-- game related data
|
||||||
local currentLevelTime = nil
|
local currentLevelTime = nil
|
||||||
|
@ -66,6 +67,10 @@ function wolfa_getBasePath()
|
||||||
return basepath
|
return basepath
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function wolfa_getHomePath()
|
||||||
|
return homepath
|
||||||
|
end
|
||||||
|
|
||||||
function et_InitGame(levelTime, randomSeed, restartMap)
|
function et_InitGame(levelTime, randomSeed, restartMap)
|
||||||
et.RegisterModname("WolfAdmin "..wolfa_getVersion())
|
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()..";")
|
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
|
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.")
|
outputDebug("Warning! Not running NoQuarter, this may cause bugs. Use at your own risk.")
|
||||||
|
|
|
@ -25,11 +25,11 @@ function files.ls(directory)
|
||||||
local entries = {}
|
local entries = {}
|
||||||
|
|
||||||
if platform == "unix" then
|
if platform == "unix" then
|
||||||
command = 'ls -1 "'..wolfa_getBasePath()..directory..'"'
|
command = 'ls -1 "'..wolfa_getBasePath()..'luascripts/wolfadmin/'..directory..'"'
|
||||||
elseif platform == "windows" then
|
elseif platform == "windows" then
|
||||||
command = 'dir "'..wolfa_getBasePath()..directory..'" /b'
|
command = 'dir "'..wolfa_getBasePath()..'luascripts/wolfadmin/'..directory..'" /b'
|
||||||
end
|
end
|
||||||
|
|
||||||
for filename in io.popen(command):lines() do
|
for filename in io.popen(command):lines() do
|
||||||
table.insert(entries, filename)
|
table.insert(entries, filename)
|
||||||
end
|
end
|
||||||
|
@ -133,4 +133,4 @@ function files.save(fileName, array)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
return files
|
return files
|
||||||
|
|
Loading…
Reference in a new issue