aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/startup.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/util/startup.lua b/util/startup.lua
index 82d0804d..e88ed709 100644
--- a/util/startup.lua
+++ b/util/startup.lua
@@ -231,8 +231,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