m-schmoock/lcpp

__FILE__ is not quoted on substitution.

ayourtch opened this issue · 1 comments

Testcase:

print(__FILE__)

The file name gets substituted without the double quotes.

The following diff takes care of it:

@@ -1404,7 +1413,7 @@ function lcpp.compileFile(filename, predefines, macro_sources, next, _local)
        if not file then error("file not found: "..filename) end
        local code = file:read('*a')
        predefines = predefines or {}
-       predefines[__FILE__] = filename
+       predefines[__FILE__] = '"' .. filename .. '"'
        return lcpp.compile(code, predefines, macro_sources)
 end