# HG changeset patch # User Kim Alvefur # Date 1572824209 -3600 # Node ID 986349fc0f9ed0de7cb2ae2ad7aa975ae483d0c9 # Parent d748f0cb45b10f59bec759e1111b5699fff5276b# Parent 82705ec87253d9e3c1b4c9ea1b0130e0e43d2a85 Merge 0.11->trunk diff -r d748f0cb45b1 -r 986349fc0f9e util/startup.lua --- 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