Software /
code /
prosody
Changeset
4243:8973653feb35
Merge 0.8 -> trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 05 Apr 2011 14:38:08 +0100 |
parents | 4238:05f991b4a90e (current diff) 4242:fad4a24f10bc (diff) |
children | 4245:2494d299d8a2 |
files | |
diffstat | 3 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Tue Apr 05 13:26:43 2011 +0100 +++ b/.hgtags Tue Apr 05 14:38:08 2011 +0100 @@ -40,3 +40,4 @@ ea80531e5cbc567c3e211d38749c45e8b66d33b7 0.7.0 ea80531e5cbc567c3e211d38749c45e8b66d33b7 0.7.0 5ea90ee96022b9c106e7e79b4a1d8b2ee99d45dc 0.7.0 +49b9e73e31ef38ff1c0141a83f897b5837c40d83 0.8.0
--- a/tools/migration/migrator/prosody_files.lua Tue Apr 05 13:26:43 2011 +0100 +++ b/tools/migration/migrator/prosody_files.lua Tue Apr 05 14:38:08 2011 +0100 @@ -13,6 +13,7 @@ local next = next; local pairs = pairs; local json = require "util.json"; +local os_getenv = os.getenv; prosody = {}; local dm = require "util.datamanager" @@ -22,7 +23,7 @@ local function is_dir(path) return lfs.attributes(path, "mode") == "directory"; end local function is_file(path) return lfs.attributes(path, "mode") == "file"; end local function clean_path(path) - return path:gsub("\\", "/"):gsub("//+", "/"); + return path:gsub("\\", "/"):gsub("//+", "/"):gsub("^~", os_getenv("HOME") or "~"); end local encode, decode; do local urlcodes = setmetatable({}, { __index = function (t, k) t[k] = char(tonumber("0x"..k)); return t[k]; end });
--- 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");