Cross-platform(?) file existence check.

This commit is contained in:
Atirut Wattanamongkol 2021-04-16 16:56:43 +07:00
parent 832798a3a5
commit 20aa15556a
1 changed files with 2 additions and 2 deletions

View File

@ -1,8 +1,8 @@
function directives.include(env, file)
if (not os.execute("stat "..file..">/dev/null")) then
local f = io.open(file, "r")
if f == nil then
return false, "File `"..file.."' does not exist!"
end
local f = io.open(file, "r")
local fast = mkast(f, file)
fast.file = file
local code = generate(fast)