aboutsummaryrefslogtreecommitdiffstats
path: root/util/startup.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-11-04 00:36:49 +0100
committerKim Alvefur <zash@zash.se>2019-11-04 00:36:49 +0100
commitc03b2a990791962d7e9ff794557b827bb6c4cbb4 (patch)
treea293053343193cc681d0ef6293828dbc650829f9 /util/startup.lua
parent724cc7f24ae27a969305e100cf57926a768fc9da (diff)
parent65bbfdb65b7abecb941537de863e4856e5b637cd (diff)
downloadprosody-c03b2a990791962d7e9ff794557b827bb6c4cbb4.tar.gz
prosody-c03b2a990791962d7e9ff794557b827bb6c4cbb4.zip
Merge 0.11->trunk
Diffstat (limited to 'util/startup.lua')
-rw-r--r--util/startup.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/util/startup.lua b/util/startup.lua
index 580410c9..62fd5579 100644
--- a/util/startup.lua
+++ b/util/startup.lua
@@ -34,7 +34,8 @@ function startup.read_config()
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 @@ end
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