diff options
Diffstat (limited to 'src/MoonP/stacktraceplus.h')
| -rw-r--r-- | src/MoonP/stacktraceplus.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/MoonP/stacktraceplus.h b/src/MoonP/stacktraceplus.h index ea53885..3d32322 100644 --- a/src/MoonP/stacktraceplus.h +++ b/src/MoonP/stacktraceplus.h | |||
| @@ -324,8 +324,17 @@ local function getMoonLineNumber(fname, line) | |||
| 324 | source = moonCompiled["@="..fname] | 324 | source = moonCompiled["@="..fname] |
| 325 | end | 325 | end |
| 326 | if not source then | 326 | if not source then |
| 327 | if moonp.file_exist(fname) then | 327 | local name_path = fname:gsub("%.", moonp.dirsep) |
| 328 | local codes = moonp.read_file(fname) | 328 | local file_exist, file_path |
| 329 | for path in package.path:gmatch("[^;]+") do | ||
| 330 | file_path = path:gsub("?", name_path) | ||
| 331 | file_exist = moonp.file_exist(file_path) | ||
| 332 | if file_exist then | ||
| 333 | break | ||
| 334 | end | ||
| 335 | end | ||
| 336 | if file_exist then | ||
| 337 | local codes = moonp.read_file(file_path) | ||
| 329 | local moonFile = codes:match("^%s*--%s*%[moon%]:%s*([^\n]*)") | 338 | local moonFile = codes:match("^%s*--%s*%[moon%]:%s*([^\n]*)") |
| 330 | if moonFile then | 339 | if moonFile then |
| 331 | fname = moonFile:gsub("^%s*(.-)%s*$", "%1") | 340 | fname = moonFile:gsub("^%s*(.-)%s*$", "%1") |
