diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/cfg.lua | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 8368ee7e..704c7daf 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua | |||
@@ -125,6 +125,24 @@ else | |||
125 | -- Fall back to Unix in unknown systems. | 125 | -- Fall back to Unix in unknown systems. |
126 | end | 126 | end |
127 | 127 | ||
128 | -- Set order for platform overrides | ||
129 | local platform_order = { | ||
130 | -- Unixes | ||
131 | unix = 1, | ||
132 | bsd = 2, | ||
133 | solaris = 3, | ||
134 | netbsd = 4, | ||
135 | openbsd = 5, | ||
136 | freebsd = 6, | ||
137 | linux = 7, | ||
138 | macosx = 8, | ||
139 | cygwin = 9, | ||
140 | -- Windows | ||
141 | win32 = 10, | ||
142 | mingw32 = 11, | ||
143 | windows = 12 } | ||
144 | |||
145 | |||
128 | -- Path configuration: | 146 | -- Path configuration: |
129 | local sys_config_file, home_config_file | 147 | local sys_config_file, home_config_file |
130 | local sys_config_file_default, home_config_file_default | 148 | local sys_config_file_default, home_config_file_default |
@@ -237,7 +255,15 @@ end | |||
237 | -- update platforms list; keyed -> array | 255 | -- update platforms list; keyed -> array |
238 | do | 256 | do |
239 | local lst = {} -- use temp array to not confuse `pairs` in loop | 257 | local lst = {} -- use temp array to not confuse `pairs` in loop |
240 | for plat in pairs(cfg.platforms) do table.insert(lst, plat) end | 258 | for plat in pairs(cfg.platforms) do |
259 | if cfg.platforms[plat] then -- entries set to 'false' skipped | ||
260 | table.insert(lst, plat) | ||
261 | else | ||
262 | cfg.platforms[plat] = nil | ||
263 | end | ||
264 | end | ||
265 | -- platform overrides depent on the order, so set priorities | ||
266 | table.sort(lst, function(key1, key2) return platform_order[key1] < platform_order[key2] end) | ||
241 | util.deep_merge(cfg.platforms, lst) | 267 | util.deep_merge(cfg.platforms, lst) |
242 | end | 268 | end |
243 | 269 | ||