prosody

changeset 3402
dfc369314e53
parent 3354
b4ebda3fd6e9
child 3413
7d34bcbf104c
equal deleted inserted replaced
3401:2387f35db5c8 3402:dfc369314e53
163 prosody.paths = { source = CFG_SOURCEDIR, config = CFG_CONFIGDIR, 163 prosody.paths = { source = CFG_SOURCEDIR, config = CFG_CONFIGDIR,
164 plugins = CFG_PLUGINDIR, data = CFG_DATADIR }; 164 plugins = CFG_PLUGINDIR, data = CFG_DATADIR };
165 165
166 local path_sep = package.config:sub(1,1); 166 local path_sep = package.config:sub(1,1);
167 local rel_path_start = ".."..path_sep; 167 local rel_path_start = ".."..path_sep;
168 function prosody.resolve_relative_path(path) 168 function prosody.resolve_relative_path(parent_path, path)
169 if path then 169 if path then
170 local is_relative; 170 local is_relative;
171 if path_sep == "/" and path:sub(1,1) ~= "/" then 171 if path_sep == "/" and path:sub(1,1) ~= "/" then
172 is_relative = true; 172 is_relative = true;
173 elseif path_sep == "\\" and (path:sub(1,1) ~= "/" and path:sub(2,3) ~= ":\\") then 173 elseif path_sep == "\\" and (path:sub(1,1) ~= "/" and path:sub(2,3) ~= ":\\") then
174 is_relative = true; 174 is_relative = true;
175 end 175 end
176 if is_relative then 176 if is_relative then
177 return CFG_CONFIGDIR..path_sep..path; 177 return parent_path..path_sep..path;
178 end 178 end
179 end 179 end
180 return path; 180 return path;
181 end 181 end
182 182

mercurial