Software /
code /
prosody
Changeset
10391:986349fc0f9e
Merge 0.11->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 04 Nov 2019 00:36:49 +0100 |
parents | 10388:d748f0cb45b1 (current diff) 10390:82705ec87253 (diff) |
children | 10392:7a95f27ac9d6 |
files | util/startup.lua |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/util/startup.lua Sun Nov 03 17:44:14 2019 +0100 +++ b/util/startup.lua Mon Nov 04 00:36:49 2019 +0100 @@ -34,7 +34,8 @@ if file then file:close(); prosody.config_file = filename; - CFG_CONFIGDIR = filename:match("^(.*)[\\/][^\\/]*$"); -- luacheck: ignore 111 + prosody.paths.config = filename:match("^(.*)[\\/][^\\/]*$"); + CFG_CONFIGDIR = prosody.paths.config; -- luacheck: ignore 111 break; end end @@ -244,8 +245,14 @@ function startup.chdir() if prosody.installed then + local lfs = require "lfs"; + -- Ensure paths are absolute, not relative to the working directory which we're about to change + local cwd = lfs.currentdir(); + prosody.paths.source = config.resolve_relative_path(cwd, prosody.paths.source); + prosody.paths.config = config.resolve_relative_path(cwd, prosody.paths.config); + prosody.paths.data = config.resolve_relative_path(cwd, prosody.paths.data); -- Change working directory to data path. - require "lfs".chdir(prosody.paths.data); + lfs.chdir(prosody.paths.data); end end