Software /
code /
prosody
Comparison
core/configmanager.lua @ 3929:7cb03d67101b
configmanager: Filenames without a path are also relative to the config file path, not the current working directory
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 21 Dec 2010 22:25:54 +0000 |
parent | 3905:9222dad9e1e8 |
child | 4001:2e8411f6cb14 |
comparison
equal
deleted
inserted
replaced
3928:4dfb345e33ec | 3929:7cb03d67101b |
---|---|
219 | 219 |
220 function env.Include(file, wildcard) | 220 function env.Include(file, wildcard) |
221 if file:match("[*?]") then | 221 if file:match("[*?]") then |
222 local path_pos, glob = file:match("()([^"..path_sep.."]+)$"); | 222 local path_pos, glob = file:match("()([^"..path_sep.."]+)$"); |
223 local path = file:sub(1, math_max(path_pos-2,0)); | 223 local path = file:sub(1, math_max(path_pos-2,0)); |
224 local config_path = config_file:gsub("[^"..path_sep.."]+$", ""); | |
224 if #path > 0 then | 225 if #path > 0 then |
225 path = resolve_relative_path(config_file:gsub("[^"..path_sep.."]+$", ""), path); | 226 path = resolve_relative_path(config_path, path); |
226 else | 227 else |
227 path = "."; | 228 path = config_path; |
228 end | 229 end |
229 local patt = glob_to_pattern(glob); | 230 local patt = glob_to_pattern(glob); |
230 for f in lfs.dir(path) do | 231 for f in lfs.dir(path) do |
231 if f:sub(1,1) ~= "." and f:match(patt) then | 232 if f:sub(1,1) ~= "." and f:match(patt) then |
232 env.Include(path..path_sep..f); | 233 env.Include(path..path_sep..f); |