- now Linux installer will also automatically move mydata from previous versions to the new .megaglest path

This commit is contained in:
Mark Vejvoda 2011-04-14 15:40:53 +00:00
parent 61577825fb
commit 8bcca7080f
2 changed files with 32 additions and 1 deletions

View File

@ -30,6 +30,15 @@ MojoSetup.applocalization = {
it = "Licenza di Megaglest",
};
["Megaglest Uninstall Title"] = {
en_GB = "Remove previous version",
en_CA = "Remove previous version",
de = "Remove previous version",
es = "Remove previous version",
pl = "Remove previous version",
it = "Remove previous version",
};
["Megaglest Uninstall Prompt"] = {
en_GB = "We have detected a previous installation of Megaglest, should we remove it?",
en_CA = "We have detected a previous installation of Megaglest, should we remove it?",

View File

@ -33,9 +33,31 @@ Setup.Package
end
if previousPath ~= '' then
if MojoSetup.promptyn('Remove previous version', _("Megaglest Uninstall Prompt") .. '\n\n[' .. previousPath .. ']') then
if MojoSetup.promptyn(_("Megaglest Uninstall Title"), _("Megaglest Uninstall Prompt") .. '\n\n[' .. previousPath .. ']') then
os.execute(previousPath .. 'uninstall-megaglest.sh')
end
end
end,
preinstall = function(package)
local previousPath = ''
if MojoSetup.platform.exists(MojoSetup.info.homedir .. '/megaglest/mydata/') then
previousPath = MojoSetup.info.homedir .. '/megaglest/mydata/'
elseif MojoSetup.platform.exists('/opt/games/megaglest/mydata/') then
previousPath = '/opt/games/megaglest/mydata/'
elseif MojoSetup.platform.exists('/usr/local/games/megaglest/mydata/') then
previousPath = '/usr/local/games/megaglest/mydata/'
end
-- Move mod data folder to new location if we find it
if previousPath ~= '' then
local instPathData = MojoSetup.info.homedir .. '/.megaglest/'
local instPath = instPathData
-- MojoSetup.msgbox('Moving mod folder','About to move mod folder from [' .. previousPath .. '] to [' .. instPath .. ']')
os.execute('mkdir ' .. instPathData)
os.execute('mv ' .. previousPath .. '* ' .. instPath)
end
end,