Windows: Temporarily fix crash on break computer
Check if `os.execute` is available before attempting to use it (is not available on Windows). This is not a real fix as it results in empty directories being left behind in the computer files. The only actual fix to this issue is an official `rmdir` Minetest API.
This commit is contained in:
parent
dc6c24e669
commit
6cf860b0b1
@ -67,8 +67,10 @@ function builtin.mkdir(path)
|
|||||||
if not io.open(path) then
|
if not io.open(path) then
|
||||||
if minetest.mkdir then
|
if minetest.mkdir then
|
||||||
minetest.mkdir(path) -- create directory if minetest.mkdir is available
|
minetest.mkdir(path) -- create directory if minetest.mkdir is available
|
||||||
else
|
elseif os.execute then
|
||||||
os.execute('mkdir "'..path..'"') -- create directory with os mkdir command
|
os.execute('mkdir "'..path..'"') -- create directory with os mkdir command
|
||||||
|
else
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -97,7 +99,9 @@ function builtin.rmdir(path)
|
|||||||
|
|
||||||
local ok, msg = os.remove(dpath)
|
local ok, msg = os.remove(dpath)
|
||||||
if not ok then
|
if not ok then
|
||||||
os.execute("rmdir "..dpath)
|
if os.execute then
|
||||||
|
os.execute("rmdir "..dpath)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user