Diff

tools/migration/prosody-migrator.lua @ 4239:69fe5fd861e7

tools/migration: Support for ~/ in paths
author Matthew Wild <mwild1@gmail.com>
date Tue, 05 Apr 2011 14:11:25 +0100
parent 4235:899ffc1674b5
child 4240:b3d9063aad4d
line wrap: on
line diff
--- a/tools/migration/prosody-migrator.lua	Tue Apr 05 13:26:19 2011 +0100
+++ b/tools/migration/prosody-migrator.lua	Tue Apr 05 14:11:25 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