package{,c}path fixes for migration tools

This commit is contained in:
Vadim Misbakh-Soloviov 2013-06-14 15:15:05 +07:00
parent 410ab5d97b
commit ceff8cb313
5 changed files with 34 additions and 5 deletions

View file

@ -11,8 +11,10 @@
package.path = package.path ..";../?.lua";
if arg[0]:match("[/\\]") then
package.path = package.path .. ";"..arg[0]:gsub("[^/\\]*$", "?.lua");
local my_name = arg[0];
if my_name:match("[/\\]") then
package.path = package.path..";"..my_name:gsub("[^/\\]+$", "../?.lua");
package.cpath = package.cpath..";"..my_name:gsub("[^/\\]+$", "../?.so");
end
local erlparse = require "erlparse";
@ -229,10 +231,10 @@ local help = "/? -? ? /h -h /help -help --help";
if not arg or help:find(arg, 1, true) then
print([[ejabberd db dump importer for Prosody
Usage: ejabberd2prosody.lua filename.txt
Usage: ]]..my_name..[[ filename.txt
The file can be generated from ejabberd using:
sudo ./bin/ejabberdctl dump filename.txt
sudo ejabberdctl dump filename.txt
Note: The path of ejabberdctl depends on your ejabberd installation, and ejabberd needs to be running for ejabberdctl to work.]]);
os.exit(1);

View file

@ -10,6 +10,14 @@
prosody = {};
package.path = package.path ..";../?.lua";
local my_name = arg[0];
if my_name:match("[/\\]") then
package.path = package.path..";"..my_name:gsub("[^/\\]+$", "../?.lua");
package.cpath = package.cpath..";"..my_name:gsub("[^/\\]+$", "../?.so");
end
local serialize = require "util.serialization".serialize;
local st = require "util.stanza";
local parse_xml = require "util.xml".parse;

View file

@ -428,7 +428,14 @@ end
end
-- import modules
package.path = [[C:\Documents and Settings\Waqas\Desktop\mercurial\prosody-hg\?.lua;]]..package.path;
package.path = package.path.."..\?.lua;";
local my_name = arg[0];
if my_name:match("[/\\]") then
package.path = package.path..";"..my_name:gsub("[^/\\]+$", "../?.lua");
package.cpath = package.cpath..";"..my_name:gsub("[^/\\]+$", "../?.so");
end
-- ugly workaround for getting datamanager to work outside of prosody :(
prosody = { };

View file

@ -9,6 +9,12 @@
package.path = package.path..";../?.lua";
package.cpath = package.cpath..";../?.so"; -- needed for util.pposix used in datamanager
local my_name = arg[0];
if my_name:match("[/\\]") then
package.path = package.path..";"..my_name:gsub("[^/\\]+$", "../?.lua");
package.cpath = package.cpath..";"..my_name:gsub("[^/\\]+$", "../?.so");
end
-- ugly workaround for getting datamanager to work outside of prosody :(
prosody = { };
prosody.platform = "unknown";

View file

@ -25,6 +25,12 @@
package.path = package.path..";../?.lua";
package.cpath = package.cpath..";../?.so"; -- needed for util.pposix used in datamanager
local my_name = arg[0];
if my_name:match("[/\\]") then
package.path = package.path..";"..my_name:gsub("[^/\\]+$", "../?.lua");
package.cpath = package.cpath..";"..my_name:gsub("[^/\\]+$", "../?.so");
end
-- ugly workaround for getting datamanager to work outside of prosody :(
prosody = { };
prosody.platform = "unknown";