Using file path rules
This commit is contained in:
@@ -187,8 +187,6 @@ char *ToColor(const char *value) {
|
||||
|
||||
S8_String LuaScript = R"==(
|
||||
-- @todo: should we rewrite linux paths to windows on windows and vice-versa?
|
||||
WorkingDir = "C:/text_editor"
|
||||
OperatingSystem = "Windows"
|
||||
|
||||
function GenericTextFileRule(_s)
|
||||
function match_path(s)
|
||||
@@ -197,7 +195,7 @@ function GenericTextFileRule(_s)
|
||||
local working_dir_i, working_dir_j = string.find(s, "^%./.+")
|
||||
if working_dir_j then
|
||||
result = s:sub(3)
|
||||
result = WorkingDir.."/"..result
|
||||
result = GetWorkingDir().."/"..result
|
||||
return result
|
||||
end
|
||||
|
||||
@@ -225,8 +223,8 @@ function GenericTextFileRule(_s)
|
||||
end
|
||||
|
||||
function match_line_col(s)
|
||||
local line = 0
|
||||
local col = 0
|
||||
local line = 1
|
||||
local col = 1
|
||||
|
||||
-- filename:line:column
|
||||
local lci, lcj = s:find(":%d+:%d+$")
|
||||
@@ -297,7 +295,7 @@ end
|
||||
Rules = {}
|
||||
Rules[#Rules + 1] = GenericTextFileRule
|
||||
|
||||
function ResolvePath(s)
|
||||
function ApplyRules(s)
|
||||
for i = #Rules,1,-1 do
|
||||
rule = Rules[i]
|
||||
result = rule(s)
|
||||
|
||||
Reference in New Issue
Block a user