aboutsummaryrefslogtreecommitdiffstats
path: root/util
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
commitc679f937e8ec144f3cbfdabd441a56987b8ffb86 (patch)
treea293053343193cc681d0ef6293828dbc650829f9 /util
parentac663e1b7846213022f9d142174edbf7b3167d09 (diff)
parent91156ab5d9ea64f1c8f47aa5f30c06d8fc896056 (diff)
downloadprosody-c679f937e8ec144f3cbfdabd441a56987b8ffb86.tar.gz
prosody-c679f937e8ec144f3cbfdabd441a56987b8ffb86.zip
Merge 0.11->trunk
Diffstat (limited to 'util')
-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