forked from Simnation/Main
ed
This commit is contained in:
parent
19fb68f805
commit
01d047b3cc
53 changed files with 3222 additions and 5 deletions
44
resources/[housing]/ox_doorlock/server/utils.lua
Normal file
44
resources/[housing]/ox_doorlock/server/utils.lua
Normal file
|
@ -0,0 +1,44 @@
|
|||
local resourcePath = GetResourcePath(cache.resource):gsub('//', '/') .. '/'
|
||||
|
||||
local utils = {}
|
||||
|
||||
function utils.getFilesInDirectory(path, pattern)
|
||||
local files = {}
|
||||
local fileCount = 0
|
||||
local system = os.getenv('OS')
|
||||
local command = system and system:match('Windows') and 'dir "' or 'ls "'
|
||||
local suffix = command == 'dir "' and '/" /b' or '/"'
|
||||
local dir = io.popen(command .. resourcePath .. path .. suffix)
|
||||
|
||||
if dir then
|
||||
for line in dir:lines() do
|
||||
if line:match(pattern) then
|
||||
fileCount += 1
|
||||
files[fileCount] = line:gsub(pattern, '')
|
||||
end
|
||||
end
|
||||
|
||||
dir:close()
|
||||
end
|
||||
|
||||
return files, fileCount
|
||||
end
|
||||
|
||||
local frameworks = { 'es_extended', 'ND_Core', 'ox_core', 'qb-core' }
|
||||
local sucess = false
|
||||
|
||||
for i = 1, #frameworks do
|
||||
local framework = frameworks[i]
|
||||
|
||||
if GetResourceState(framework):find('start') then
|
||||
require(('server.framework.%s'):format(framework:lower()))
|
||||
sucess = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not sucess then
|
||||
warn('no compatible framework was loaded, most features will not work')
|
||||
end
|
||||
|
||||
return utils
|
Loading…
Add table
Add a link
Reference in a new issue