# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1521755138 0
# Node ID d49acc9a8da2b476168ada9176195943127ed69a
# Parent  a7a9d9511dc1b93de9f214c0fc7b493806fe8c57
util.startup: Fix chdir() to use correct path variable

diff -r a7a9d9511dc1 -r d49acc9a8da2 util/startup.lua
--- a/util/startup.lua	Thu Mar 22 21:18:58 2018 +0000
+++ b/util/startup.lua	Thu Mar 22 21:45:38 2018 +0000
@@ -179,13 +179,6 @@
 	end
 end
 
-function startup.chdir()
-	if prosody.installed then
-		-- Change working directory to data path.
-		require "lfs".chdir(data_path);
-	end
-end
-
 function startup.init_global_state()
 	-- luacheck: ignore 121
 	prosody.bare_sessions = {};
@@ -216,6 +209,13 @@
 	_G.prosody = prosody;
 end
 
+function startup.chdir()
+	if prosody.installed then
+		-- Change working directory to data path.
+		require "lfs".chdir(prosody.paths.data);
+	end
+end
+
 function startup.add_global_prosody_functions()
 	-- Function to reload the config file
 	function prosody.reload_config()