From 039307983f109ed43bfa5c0995beb97c8c6d796f Mon Sep 17 00:00:00 2001 From: Jasper den Ouden Date: Sun, 7 Jun 2020 15:43:27 +0200 Subject: [PATCH] Searching for the file should just return `nil`. This fixes getting the correct return when it is not found --- src/inbuild.lua | 3 ++- src/include.lua | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/inbuild.lua b/src/inbuild.lua index 72e3c0b..4490fd6 100644 --- a/src/inbuild.lua +++ b/src/inbuild.lua @@ -110,7 +110,8 @@ if args[2] and string.match(args[2], "^.+[.]lua$") then else -- Otherwise, figure out the file. args.config_file = include_file(args[2]) if not args.config_file then - log(0, "Configuration %s doesnt exist.", args[2]) + log(0, "No file corresponding to configuration file `%s` found.", + args[2]) env.dont_run = true return end diff --git a/src/include.lua b/src/include.lua index b8a5904..5720ad9 100644 --- a/src/include.lua +++ b/src/include.lua @@ -11,7 +11,6 @@ function include_file(name) return dir .. name .. ".lua" end end - assert(false, "File `" .. name .. "` doesnt exist.") end local included, on_way = {}, {} @@ -26,6 +25,7 @@ function include(name) on_way[name] = true local file = include_file(name) + assert(file, "File `" .. name .. "` doesnt exist.") got, err = loadfile(file, nil, env) if got then -- 2.45.2