1 local t_concat = table.concat;
3 local path_sep = package.config:sub(1,1);
7 -- Helper function to resolve relative paths (needed by config)
8 function path_util.resolve_relative_path(parent_path, path)
11 parent_path = parent_path:gsub("%"..path_sep.."+$", "");
12 path = path:gsub("^%.%"..path_sep.."+", "");
15 if path_sep == "/" and path:sub(1,1) ~= "/" then
17 elseif path_sep == "\\" and (path:sub(1,1) ~= "/" and (path:sub(2,3) ~= ":\\" and path:sub(2,3) ~= ":/")) then
21 return parent_path..path_sep..path;
27 -- Helper function to convert a glob to a Lua pattern
28 function path_util.glob_to_pattern(glob)
29 return "^"..glob:gsub("[%p*?]", function (c)
40 function path_util.join(...)
41 return t_concat({...}, path_sep);