Changeset

5134:43c5227fdd3b

prosody, prosodyctl: chdir() to data directory on startup
author Matthew Wild <mwild1@gmail.com>
date Wed, 19 Sep 2012 12:39:21 +0100
parents 5133:1443d1c37c6c
children 5135:52eafe0e9772 5142:3221746f4769
files prosody prosodyctl
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/prosody	Wed Sep 19 12:14:08 2012 +0100
+++ b/prosody	Wed Sep 19 12:39:21 2012 +0100
@@ -228,6 +228,11 @@
 		prosody.installed = true;
 	end
 	
+	if prosody.installed then
+		-- Change working directory to data path.
+		require "lfs".chdir(data_path);
+	end
+
 	-- Function to reload the config file
 	function prosody.reload_config()
 		log("info", "Reloading configuration file");
--- a/prosodyctl	Wed Sep 19 12:14:08 2012 +0100
+++ b/prosodyctl	Wed Sep 19 12:39:21 2012 +0100
@@ -50,6 +50,7 @@
 	platform = "posix";
 	lock_globals = function () end;
 	unlock_globals = function () end;
+	installed = CFG_SOURCEDIR ~= nil;
 };
 _G.prosody = prosody;
 
@@ -119,6 +120,11 @@
 prosody.paths = { source = CFG_SOURCEDIR, config = CFG_CONFIGDIR, 
 	          plugins = CFG_PLUGINDIR or "plugins", data = data_path };
 
+if prosody.installed then
+	-- Change working directory to data path.
+	require "lfs".chdir(data_path);
+end
+
 require "core.loggingmanager"
 
 dependencies.log_warnings();