Merge from waqas
[prosody.git] / tools / ejabberd2prosody.lua
old mode 100644 (file)
new mode 100755 (executable)
index 60cb8b1..33f60c9
@@ -1,3 +1,24 @@
+#!/usr/bin/env lua
+-- Prosody IM v0.1
+-- Copyright (C) 2008 Matthew Wild
+-- Copyright (C) 2008 Waqas Hussain
+-- 
+-- This program is free software; you can redistribute it and/or
+-- modify it under the terms of the GNU General Public License
+-- as published by the Free Software Foundation; either version 2
+-- of the License, or (at your option) any later version.
+-- 
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-- GNU General Public License for more details.
+-- 
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+--
+
+
 \r
 require "erlparse";\r
 require "serialize";\r
@@ -9,9 +30,10 @@ local dm = require "util.datamanager"
 local data_path = "data";\r
 dm.set_data_path(data_path);\r
 \r
+local path_separator = "/"; if os.getenv("WINDIR") then path_separator = "\\" end\r
 local _mkdir = {}\r
 function mkdir(path)\r
-       path = path:gsub("/", "\\");\r
+       path = path:gsub("/", path_separator);\r
        --print("mkdir",path);\r
        local x = io.popen("mkdir "..path.." 2>&1"):read("*a");\r
 end\r