fix bug in linux
This commit is contained in:
parent
ed882224d2
commit
47c2e9b058
@ -19,13 +19,20 @@ deploy_building = {}
|
|||||||
|
|
||||||
-- get_files
|
-- get_files
|
||||||
deploy_building.get_files = function(size)
|
deploy_building.get_files = function(size)
|
||||||
local directory = minetest.get_modpath("deploy_building").."/buildings/"..size
|
local modpath = minetest.get_modpath("deploy_building")
|
||||||
local command = 'dir "'..directory..'\\*.we" /b' -- windows
|
local output
|
||||||
if os.getenv('home')~=nil then
|
if os.getenv('HOME')~=nil then
|
||||||
command = 'ls -a "'..directory..'/*.we"' -- linux/mac
|
os.execute('\ls -a "'..modpath..'/buildings/'..size..'/" | grep .we > "'..modpath..'/buildings/'..size..'/_buildings"') -- linux/mac
|
||||||
|
local file, err = io.open(modpath..'/buildings/'..size..'/_buildings', "rb")
|
||||||
|
if err ~= nil then
|
||||||
|
return
|
||||||
end
|
end
|
||||||
local i, t, popen = 0, {}, io.popen
|
output = file:lines()
|
||||||
for filename in popen(command):lines() do
|
else
|
||||||
|
output = io.popen('dir "'..modpath..'\\buildings\\'..size..'\\*.we" /b'):lines() -- windows
|
||||||
|
end
|
||||||
|
local i, t = 0, {}
|
||||||
|
for filename in output do
|
||||||
i = i + 1
|
i = i + 1
|
||||||
t[i] = filename
|
t[i] = filename
|
||||||
end
|
end
|
||||||
|
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 225 B |
Loading…
x
Reference in New Issue
Block a user