@@ -72,6 +72,34 @@ local function cleanup_path(temppath)
72
72
return temppath
73
73
end
74
74
75
+ local function load_texture_packs (txtpath , retval )
76
+ local list = core .get_dir_list (txtpath , true )
77
+ local current_texture_path = core .settings :get (" texture_path" )
78
+
79
+ for _ , item in ipairs (list ) do
80
+ if item ~= " base" then
81
+ local name = item
82
+
83
+ local path = txtpath .. DIR_DELIM .. item .. DIR_DELIM
84
+ if path == current_texture_path then
85
+ name = fgettext (" $1 (Enabled)" , name )
86
+ end
87
+
88
+ local conf = Settings (path .. " texture_pack.conf" )
89
+
90
+ retval [# retval + 1 ] = {
91
+ name = item ,
92
+ author = conf :get (" author" ),
93
+ release = tonumber (conf :get (" release" ) or " 0" ),
94
+ list_name = name ,
95
+ type = " txp" ,
96
+ path = path ,
97
+ enabled = path == current_texture_path ,
98
+ }
99
+ end
100
+ end
101
+ end
102
+
75
103
function get_mods (path ,retval ,modpack )
76
104
local mods = core .get_dir_list (path , true )
77
105
@@ -112,7 +140,7 @@ function get_mods(path,retval,modpack)
112
140
toadd .type = " mod"
113
141
114
142
-- Check modpack.txt
115
- -- Note: modpack.conf is already checked above
143
+ -- Note: modpack.conf is already checked above
116
144
local modpackfile = io.open (prefix .. DIR_DELIM .. " modpack.txt" )
117
145
if modpackfile then
118
146
modpackfile :close ()
@@ -136,32 +164,13 @@ pkgmgr = {}
136
164
137
165
function pkgmgr .get_texture_packs ()
138
166
local txtpath = core .get_texturepath ()
139
- local list = core .get_dir_list ( txtpath , true )
167
+ local txtpath_system = core .get_texturepath_share ( )
140
168
local retval = {}
141
169
142
- local current_texture_path = core .settings :get (" texture_path" )
143
-
144
- for _ , item in ipairs (list ) do
145
- if item ~= " base" then
146
- local name = item
147
-
148
- local path = txtpath .. DIR_DELIM .. item .. DIR_DELIM
149
- if path == current_texture_path then
150
- name = fgettext (" $1 (Enabled)" , name )
151
- end
152
-
153
- local conf = Settings (path .. " texture_pack.conf" )
154
-
155
- retval [# retval + 1 ] = {
156
- name = item ,
157
- author = conf :get (" author" ),
158
- release = tonumber (conf :get (" release" ) or " 0" ),
159
- list_name = name ,
160
- type = " txp" ,
161
- path = path ,
162
- enabled = path == current_texture_path ,
163
- }
164
- end
170
+ load_texture_packs (txtpath , retval )
171
+ -- on portable versions these two paths coincide. It avoids loading the path twice
172
+ if txtpath ~= txtpath_system then
173
+ load_texture_packs (txtpath_system , retval )
165
174
end
166
175
167
176
table.sort (retval , function (a , b )
0 commit comments