fixed auto updating issues on Linux

pull/8/head
Miepee 6 years ago
parent ed899c5e15
commit 41e236adee

@ -93,7 +93,7 @@ namespace AM2RLauncher
if (isCurrentVersionOutdated) if (isCurrentVersionOutdated)
{ {
log.Info("Current version (" + VERSION + ") is outdated! Initiating update."); log.Info("Current version (" + VERSION + ") is outdated! Initiating update for version " + onlineVersion + ".");
string tmpUpdatePath = CrossPlatformOperations.CURRENTPATH + "/tmpupdate/"; string tmpUpdatePath = CrossPlatformOperations.CURRENTPATH + "/tmpupdate/";
string zipPath = CrossPlatformOperations.CURRENTPATH + "/launcher.zip"; string zipPath = CrossPlatformOperations.CURRENTPATH + "/launcher.zip";
@ -120,16 +120,20 @@ namespace AM2RLauncher
return; return;
} }
if(!Directory.Exists(tmpUpdatePath)) // just in case it exists already
Directory.CreateDirectory(tmpUpdatePath); Directory.CreateDirectory(tmpUpdatePath);
ZipFile.ExtractToDirectory(zipPath, tmpUpdatePath); ZipFile.ExtractToDirectory(zipPath, tmpUpdatePath);
log.Info("Updates successfully extracted to " + tmpUpdatePath);
File.Delete(zipPath); File.Delete(zipPath);
File.Move(CrossPlatformOperations.LAUNCHERNAME, CrossPlatformOperations.CURRENTPATH + "/AM2RLauncher.bak"); File.Move(CrossPlatformOperations.CURRENTPATH + "/" + CrossPlatformOperations.LAUNCHERNAME, CrossPlatformOperations.CURRENTPATH + "/AM2RLauncher.bak");
if (currentPlatform.IsWinForms) File.Move(CrossPlatformOperations.LAUNCHERNAME + ".config", CrossPlatformOperations.LAUNCHERNAME + ".oldCfg"); if (currentPlatform.IsWinForms) File.Move(CrossPlatformOperations.LAUNCHERNAME + ".config", CrossPlatformOperations.LAUNCHERNAME + ".oldCfg");
foreach (var file in new DirectoryInfo(tmpUpdatePath).GetFiles()) foreach (var file in new DirectoryInfo(tmpUpdatePath).GetFiles())
{ {
File.Copy(file.FullName, CrossPlatformOperations.CURRENTPATH + "/" + file.Name, true); log.Info("Moving " + tmpUpdatePath + file.FullName + " to " + CrossPlatformOperations.CURRENTPATH + "/" + file.Name);
File.Copy(tmpUpdatePath + file.FullName, CrossPlatformOperations.CURRENTPATH + "/" + file.Name, true);
} }
Directory.Delete(tmpUpdatePath, true); Directory.Delete(tmpUpdatePath, true);

@ -2,6 +2,8 @@
:: ROBOCOPY "builds\win64" "builds\win64\lib\ " /XF *.exe *.config *.manifest /XD lib logs data /E /IS /MOVE :: ROBOCOPY "builds\win64" "builds\win64\lib\ " /XF *.exe *.config *.manifest /XD lib logs data /E /IS /MOVE
dotnet publish AM2RLauncher.Wpf -c release -r win-x86 -o "builds\win86" dotnet publish AM2RLauncher.Wpf -c release -r win-x86 -o "builds\win86"
ROBOCOPY "builds\win86" "builds\win86\lib\ " /XF *.exe *.config *.manifest /XD lib logs data /E /IS /MOVE ROBOCOPY "builds\win86" "builds\win86\lib\ " /XF *.exe *.config *.manifest /XD lib logs data /E /IS /MOVE
move .\builds\win86\AM2RLauncher.Wpf.exe .\builds\win86\AM2RLauncher.exe
move .\builds\win86\AM2RLauncher.Wpf.exe.config .\builds\win86\AM2RLauncher.exe.config
dotnet publish AM2RLauncher.Gtk -p:PublishSingleFile=true -c release -r ubuntu.18.04-x64 --no-self-contained -o "builds\linux64" dotnet publish AM2RLauncher.Gtk -p:PublishSingleFile=true -c release -r ubuntu.18.04-x64 --no-self-contained -o "builds\linux64"
dotnet publish AM2RLauncher.Gtk -p:PublishSingleFile=true -c release -r ubuntu.18.04-x64 --self-contained -o "builds\linux64-selfContained" dotnet publish AM2RLauncher.Gtk -p:PublishSingleFile=true -c release -r ubuntu.18.04-x64 --self-contained -o "builds\linux64-selfContained"

Loading…
Cancel
Save