From e29e962bd5d11dc1b0e6f18c00cb78d23f7bd2f3 Mon Sep 17 00:00:00 2001 From: Qstick Date: Thu, 25 Jun 2020 21:04:48 -0400 Subject: [PATCH] Fixed: Mac Update to another 0.X package --- src/NzbDrone.Common.Test/PathExtensionFixture.cs | 2 +- src/NzbDrone.Common/Extensions/PathExtensions.cs | 8 ++++---- src/NzbDrone.Core/Update/InstallUpdateService.cs | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/NzbDrone.Common.Test/PathExtensionFixture.cs b/src/NzbDrone.Common.Test/PathExtensionFixture.cs index 6e35561ff..58d71586f 100644 --- a/src/NzbDrone.Common.Test/PathExtensionFixture.cs +++ b/src/NzbDrone.Common.Test/PathExtensionFixture.cs @@ -263,7 +263,7 @@ namespace NzbDrone.Common.Test [Test] public void GetUpdateClientExePath() { - GetIAppDirectoryInfo().GetUpdateClientExePath().Should().BeEquivalentTo(@"C:\Temp\radarr_update\Radarr.Update.exe".AsOsAgnostic()); + GetIAppDirectoryInfo().GetUpdateClientExePath(new Version("0.2.0.1480")).Should().BeEquivalentTo(@"C:\Temp\radarr_update\Radarr.Update.exe".AsOsAgnostic()); } [Test] diff --git a/src/NzbDrone.Common/Extensions/PathExtensions.cs b/src/NzbDrone.Common/Extensions/PathExtensions.cs index e5f01f095..dea644755 100644 --- a/src/NzbDrone.Common/Extensions/PathExtensions.cs +++ b/src/NzbDrone.Common/Extensions/PathExtensions.cs @@ -192,12 +192,12 @@ namespace NzbDrone.Common.Extensions return directories; } - public static string ProcessNameToExe(this string processName) + private static string ProcessNameToExe(this string processName, Version version) { // Windows always has exe (but is shunted to net core) // Linux is kept on mono pending manual upgrade to net core so has .exe // macOS is shunted to net core and does not have .exe - if (OsInfo.IsWindows || OsInfo.IsLinux) + if (OsInfo.IsWindows || OsInfo.IsLinux || version.Major == 0) { processName += ".exe"; } @@ -272,9 +272,9 @@ namespace NzbDrone.Common.Extensions } } - public static string GetUpdateClientExePath(this IAppFolderInfo appFolderInfo) + public static string GetUpdateClientExePath(this IAppFolderInfo appFolderInfo, Version version) { - return Path.Combine(GetUpdateSandboxFolder(appFolderInfo), UPDATE_CLIENT_EXE_NAME).ProcessNameToExe(); + return Path.Combine(GetUpdateSandboxFolder(appFolderInfo), UPDATE_CLIENT_EXE_NAME).ProcessNameToExe(version); } public static string GetBackupFolder(this IAppFolderInfo appFolderInfo) diff --git a/src/NzbDrone.Core/Update/InstallUpdateService.cs b/src/NzbDrone.Core/Update/InstallUpdateService.cs index 0cfa26cab..c2d6df5ba 100644 --- a/src/NzbDrone.Core/Update/InstallUpdateService.cs +++ b/src/NzbDrone.Core/Update/InstallUpdateService.cs @@ -131,13 +131,13 @@ namespace NzbDrone.Core.Update // Set executable flag on update app if (OsInfo.IsOsx) { - _diskProvider.SetPermissions(_appFolderInfo.GetUpdateClientExePath(), "0755", null, null); + _diskProvider.SetPermissions(_appFolderInfo.GetUpdateClientExePath(updatePackage.Version), "0755", null, null); } - _logger.Info("Starting update client {0}", _appFolderInfo.GetUpdateClientExePath()); + _logger.Info("Starting update client {0}", _appFolderInfo.GetUpdateClientExePath(updatePackage.Version)); _logger.ProgressInfo("Radarr will restart shortly."); - _processProvider.Start(_appFolderInfo.GetUpdateClientExePath(), GetUpdaterArgs(updateSandboxFolder)); + _processProvider.Start(_appFolderInfo.GetUpdateClientExePath(updatePackage.Version), GetUpdaterArgs(updateSandboxFolder)); } private void EnsureValidBranch(UpdatePackage package)