fixed a few crashes resulting from the fs library

This commit is contained in:
Izaya 2017-08-04 17:44:10 +10:00
parent 57e9a106c2
commit e341ada43e

View File

@ -42,13 +42,15 @@ do
function fs.open(p,m) function fs.open(p,m)
local _,d,p = fs.resolve(p) local _,d,p = fs.resolve(p)
local d = fT[d] local d = fT[d]
local f,C=d.open(p,m),hT._c if d then
if f then local f,C=d.open(p,m),hT._c
hT._c = C + 1 if f then
hT[C] = {d,f} hT._c = C + 1
return C hT[C] = {d,f}
return C
end
return false
end end
return false
end end
function fs.close(h) function fs.close(h)
if hT[h] then if hT[h] then
@ -99,7 +101,9 @@ do
end end
function fs.exists(s) function fs.exists(s)
local _,d,p = fs.resolve(s) local _,d,p = fs.resolve(s)
return fT[d].exists(p) if d then
return fT[d].exists(p)
end
end end
function fs.isdir(s) function fs.isdir(s)
local _,d,p = fs.resolve(s) local _,d,p = fs.resolve(s)