Diff

tools/migration/prosody-migrator.lua @ 4243:8973653feb35

Merge 0.8 -> trunk
author Matthew Wild <mwild1@gmail.com>
date Tue, 05 Apr 2011 14:38:08 +0100
parent 4240:b3d9063aad4d
child 5021:85b2689dbcfe
line wrap: on
line diff
--- a/tools/migration/prosody-migrator.lua	Tue Apr 05 13:26:43 2011 +0100
+++ b/tools/migration/prosody-migrator.lua	Tue Apr 05 14:38:08 2011 +0100
@@ -3,6 +3,15 @@
 CFG_SOURCEDIR=os.getenv("PROSODY_SRCDIR");
 CFG_CONFIGDIR=os.getenv("PROSODY_CFGDIR");
 
+-- Substitute ~ with path to home directory in paths
+if CFG_CONFIGDIR then
+        CFG_CONFIGDIR = CFG_CONFIGDIR:gsub("^~", os.getenv("HOME"));
+end
+
+if CFG_SOURCEDIR then
+        CFG_SOURCEDIR = CFG_SOURCEDIR:gsub("^~", os.getenv("HOME"));
+end
+
 local default_config = (CFG_CONFIGDIR or ".").."/migrator.cfg.lua";
 
 -- Command-line parsing
@@ -116,9 +125,10 @@
 
 local json = require "util.json";
 
+io.stderr:write("Migrating...\n");
 for x in reader do
 	--print(json.encode(x))
 	writer(x);
 end
 writer(nil); -- close
-
+io.stderr:write("Done!\n");