diff --git a/mk/linux/mojosetup/megaglest-installer/scripts/app_localization.lua b/mk/linux/mojosetup/megaglest-installer/scripts/app_localization.lua index 0f1725e2..6a814bfb 100644 --- a/mk/linux/mojosetup/megaglest-installer/scripts/app_localization.lua +++ b/mk/linux/mojosetup/megaglest-installer/scripts/app_localization.lua @@ -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?", diff --git a/mk/linux/mojosetup/megaglest-installer/scripts/config.lua b/mk/linux/mojosetup/megaglest-installer/scripts/config.lua index bcbbb30d..92b65078 100644 --- a/mk/linux/mojosetup/megaglest-installer/scripts/config.lua +++ b/mk/linux/mojosetup/megaglest-installer/scripts/config.lua @@ -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,