From ffe75444d1e3ad0dcf014caa02d5e9e8b3be79e1 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 12 Sep 2016 18:48:01 +0300 Subject: [PATCH] Stable 0.10.6 (only for OS X): fixing Updater erasing. --- Telegram/Resources/winrc/Telegram.rc | 8 ++++---- Telegram/Resources/winrc/Updater.rc | 8 ++++---- Telegram/SourceFiles/_other/updater_osx.m | 15 +++++++++++++++ Telegram/SourceFiles/core/version.h | 4 ++-- Telegram/build/version | 6 +++--- 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 983ed4d62..a456e1856 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,10,5,0 - PRODUCTVERSION 0,10,5,0 + FILEVERSION 0,10,6,0 + PRODUCTVERSION 0,10,6,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -51,10 +51,10 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Telegram Messenger LLP" - VALUE "FileVersion", "0.10.5.0" + VALUE "FileVersion", "0.10.6.0" VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.10.5.0" + VALUE "ProductVersion", "0.10.6.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index aec484524..34bd669ad 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,10,5,0 - PRODUCTVERSION 0,10,5,0 + FILEVERSION 0,10,6,0 + PRODUCTVERSION 0,10,6,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -43,10 +43,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram Messenger LLP" VALUE "FileDescription", "Telegram Updater" - VALUE "FileVersion", "0.10.5.0" + VALUE "FileVersion", "0.10.6.0" VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.10.5.0" + VALUE "ProductVersion", "0.10.6.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/_other/updater_osx.m b/Telegram/SourceFiles/_other/updater_osx.m index 2c532fdd5..07e017aee 100644 --- a/Telegram/SourceFiles/_other/updater_osx.m +++ b/Telegram/SourceFiles/_other/updater_osx.m @@ -160,6 +160,21 @@ int main(int argc, const char * argv[]) { writeLog([@"Starting update files iteration, path: " stringByAppendingString: srcEnum]); + // Take the Updater (this currently running binary) from the place where it was placed by Telegram + // and copy it to the folder with the new version of the app (ready), + // so it won't be deleted when we will clear the "Telegram.app/Contents" folder. + NSString *oldVersionUpdaterPath = [appDirFull stringByAppendingString: @"/Contents/Frameworks/Updater" ]; + NSString *newVersionUpdaterPath = [srcEnum stringByAppendingString:[[NSArray arrayWithObjects:@"/", appName, @"/Contents/Frameworks/Updater", nil] componentsJoinedByString:@""]]; + writeLog([[NSArray arrayWithObjects: @"Copying Updater from old path ", oldVersionUpdaterPath, @" to new path ", newVersionUpdaterPath, nil] componentsJoinedByString:@""]); + if (![fileManager fileExistsAtPath:newVersionUpdaterPath]) { + if (![fileManager copyItemAtPath:oldVersionUpdaterPath toPath:newVersionUpdaterPath error:nil]) { + writeLog([[NSArray arrayWithObjects: @"Failed to copy file from ", oldVersionUpdaterPath, @" to ", newVersionUpdaterPath, nil] componentsJoinedByString:@""]); + delFolder(); + return -1; + } + } + + NSString *contentsPath = [appDirFull stringByAppendingString: @"/Contents"]; writeLog([[NSArray arrayWithObjects: @"Clearing dir ", contentsPath, nil] componentsJoinedByString:@""]); if (![fileManager removeItemAtPath:contentsPath error:nil]) { diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index a2627a7ce..1e2acd471 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #define BETA_VERSION_MACRO (0ULL) -constexpr int AppVersion = 10005; -constexpr str_const AppVersionStr = "0.10.5"; +constexpr int AppVersion = 10006; +constexpr str_const AppVersionStr = "0.10.6"; constexpr bool AppAlphaVersion = false; constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; diff --git a/Telegram/build/version b/Telegram/build/version index 2014aa445..a1bfbfb6e 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,6 +1,6 @@ -AppVersion 10005 +AppVersion 10006 AppVersionStrMajor 0.10 -AppVersionStrSmall 0.10.5 -AppVersionStr 0.10.5 +AppVersionStrSmall 0.10.6 +AppVersionStr 0.10.6 AlphaChannel 0 BetaVersion 0