-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgearswap.lua
More file actions
54 lines (45 loc) · 1.67 KB
/
Copy pathgearswap.lua
File metadata and controls
54 lines (45 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
require 'refresh'
function pathsearch(files_list)
-- base directory search order:
-- windower
-- %appdata%/Windower/GearSwap
-- sub directory search order:
-- libs-dev (only in windower addon path)
-- libs (only in windower addon path)
-- data/player.name
-- data/common
-- data
local gearswap_data = windower.addon_path .. 'data/'
local gearswap_appdata = (os.getenv('APPDATA') or '') .. '/Windower/GearSwap/'
local search_path = {
[1] = windower.addon_path .. 'libs-dev/',
[2] = windower.addon_path .. 'libs/',
[3] = gearswap_data .. player.name .. '/',
[4] = gearswap_data .. 'common/',
[5] = gearswap_data,
[6] = gearswap_appdata .. player.name .. '/',
[7] = gearswap_appdata .. 'common/',
[8] = gearswap_appdata,
[9] = windower.windower_path .. 'addons/libs/'
}
local user_path
local normal_path
for _,basepath in ipairs(search_path) do
if windower.dir_exists(basepath) then
for i,v in ipairs(files_list) do
if v ~= '' then
if include_user_path then
user_path = basepath .. include_user_path .. '/' .. v
end
normal_path = basepath .. v
if user_path and windower.file_exists(user_path) then
return user_path,basepath,v
elseif normal_path and windower.file_exists(normal_path) then
return normal_path,basepath,v
end
end
end
end
end
return false
end