Software /
code /
prosody
Comparison
util/startup.lua @ 10391:986349fc0f9e
Merge 0.11->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 04 Nov 2019 00:36:49 +0100 |
parent | 10210:9fdda9fafc3c |
parent | 10390:82705ec87253 |
child | 10404:29c10930a7b2 |
comparison
equal
deleted
inserted
replaced
10388:d748f0cb45b1 | 10391:986349fc0f9e |
---|---|
32 filename = _filename; | 32 filename = _filename; |
33 local file = io.open(filename); | 33 local file = io.open(filename); |
34 if file then | 34 if file then |
35 file:close(); | 35 file:close(); |
36 prosody.config_file = filename; | 36 prosody.config_file = filename; |
37 CFG_CONFIGDIR = filename:match("^(.*)[\\/][^\\/]*$"); -- luacheck: ignore 111 | 37 prosody.paths.config = filename:match("^(.*)[\\/][^\\/]*$"); |
38 CFG_CONFIGDIR = prosody.paths.config; -- luacheck: ignore 111 | |
38 break; | 39 break; |
39 end | 40 end |
40 end | 41 end |
41 prosody.config_file = filename | 42 prosody.config_file = filename |
42 local ok, level, err = config.load(filename); | 43 local ok, level, err = config.load(filename); |
242 prosody.paths.plugins = CFG_PLUGINDIR; | 243 prosody.paths.plugins = CFG_PLUGINDIR; |
243 end | 244 end |
244 | 245 |
245 function startup.chdir() | 246 function startup.chdir() |
246 if prosody.installed then | 247 if prosody.installed then |
248 local lfs = require "lfs"; | |
249 -- Ensure paths are absolute, not relative to the working directory which we're about to change | |
250 local cwd = lfs.currentdir(); | |
251 prosody.paths.source = config.resolve_relative_path(cwd, prosody.paths.source); | |
252 prosody.paths.config = config.resolve_relative_path(cwd, prosody.paths.config); | |
253 prosody.paths.data = config.resolve_relative_path(cwd, prosody.paths.data); | |
247 -- Change working directory to data path. | 254 -- Change working directory to data path. |
248 require "lfs".chdir(prosody.paths.data); | 255 lfs.chdir(prosody.paths.data); |
249 end | 256 end |
250 end | 257 end |
251 | 258 |
252 function startup.add_global_prosody_functions() | 259 function startup.add_global_prosody_functions() |
253 -- Function to reload the config file | 260 -- Function to reload the config file |