aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--nomsu_compiler.lua9
-rw-r--r--nomsu_compiler.moon6
3 files changed, 16 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 9dcdc68..420c569 100644
--- a/Makefile
+++ b/Makefile
@@ -84,7 +84,7 @@ install: lua version optimize optimize_extra
fi; \
version="`cat version`"; \
mkdir -pv $$prefix/bin $$prefix/lib/nomsu/$$version $$prefix/share/nomsu/$$version $$prefix/share/man/man1 $$packagepath/nomsu \
- && echo "#!$(LUA_BIN)\\nlocal NOMSU_PREFIX, NOMSU_PACKAGEPATH = [[$$prefix]], [[$$packagepath/nomsu]]" \
+ && echo "#!$(LUA_BIN)\\nNOMSU_PREFIX, NOMSU_PACKAGEPATH = [[$$prefix]], [[$$packagepath/nomsu]]" \
| cat - nomsu.lua > $$prefix/bin/nomsu$$version \
&& chmod +x $$prefix/bin/nomsu$$version \
&& cp -v nomsu $$prefix/bin \
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]+(.*)")
diff --git a/nomsu_compiler.moon b/nomsu_compiler.moon
index 6fa9ffd..4b684a4 100644
--- a/nomsu_compiler.moon
+++ b/nomsu_compiler.moon
@@ -30,6 +30,12 @@ fail_at = (source, msg)->
if source and not file
file = Files.read(source.filename)
+ if not file
+ if NOMSU_PREFIX
+ path = "#{NOMSU_PREFIX}/share/nomsu/#{table.concat NOMSU_VERSION, "."}/#{source.filename}"
+ file = Files.read(path)
+ if not file
+ error("Can't find file: "..tostring(source.filename))
title, err_msg, hint = msg\match("([^:]*):[ \n]+(.*)[ \n]+Hint: (.*)")
if not err_msg