From f0f3c7e0bb42f67868a840f19492c69e03b7cf17 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 22 Mar 2019 14:37:50 -0700 Subject: Fix for error reporting not finding core files --- nomsu_compiler.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'nomsu_compiler.lua') diff --git a/nomsu_compiler.lua b/nomsu_compiler.lua index af0636b..5495fde 100644 --- a/nomsu_compiler.lua +++ b/nomsu_compiler.lua @@ -36,6 +36,15 @@ fail_at = function(source, msg) if source and not file then file = Files.read(source.filename) end + if not file then + if NOMSU_PREFIX then + local path = tostring(NOMSU_PREFIX) .. "/share/nomsu/" .. tostring(table.concat(NOMSU_VERSION, ".")) .. "/" .. tostring(source.filename) + file = Files.read(path) + end + end + if not file then + error("Can't find file: " .. tostring(source.filename)) + end local title, err_msg, hint = msg:match("([^:]*):[ \n]+(.*)[ \n]+Hint: (.*)") if not err_msg then err_msg, hint = msg:match("(.*)[ \n]+Hint:[ \n]+(.*)") -- cgit v1.2.3