From aaf9dae09dbcfed91408dd1d2de2c93a52163913 Mon Sep 17 00:00:00 2001 From: Swagatam Mitra Date: Sat, 27 Jan 2018 22:33:20 +0530 Subject: [PATCH 01/32] Version bump to 1.13 --- appshell/mac/Info.plist | 4 ++-- appshell/version.rc | 4 ++-- appshell/version_linux.h | 2 +- installer/mac/buildInstaller.sh | 2 +- installer/win/brackets-win-install-build.xml | 2 +- package.json | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/appshell/mac/Info.plist b/appshell/mac/Info.plist index 88199905f..e1b8ba96a 100644 --- a/appshell/mac/Info.plist +++ b/appshell/mac/Info.plist @@ -19,9 +19,9 @@ CFBundleSignature ???? CFBundleVersion - 1.12.0 + 1.13.0 CFBundleShortVersionString - 1.12.0 + 1.13.0 NSMainNibFile MainMenu NSPrincipalClass diff --git a/appshell/version.rc b/appshell/version.rc index a8ae8b0f9..4ebc3f98e 100644 --- a/appshell/version.rc +++ b/appshell/version.rc @@ -31,7 +31,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO -FILEVERSION 1,12,0,0 +FILEVERSION 1,13,0,0 /* PRODUCTVERSION 1,0,0,0 */ FILEOS VOS__WINDOWS32 FILETYPE VFT_APP @@ -42,7 +42,7 @@ BEGIN BEGIN VALUE "CompanyName", "brackets.io\0" VALUE "FileDescription", "\0" - VALUE "FileVersion", "Release 1.12.0\0" + VALUE "FileVersion", "Release 1.13.0\0" VALUE "ProductName", APP_NAME "\0" VALUE "ProductVersion", "\0" VALUE "LegalCopyright", "(c) 2012 Adobe Systems, Inc.\0" diff --git a/appshell/version_linux.h b/appshell/version_linux.h index 56d908c87..b0a133644 100644 --- a/appshell/version_linux.h +++ b/appshell/version_linux.h @@ -1 +1 @@ -#define APP_VERSION "1.12.0.0" +#define APP_VERSION "1.13.0.0" diff --git a/installer/mac/buildInstaller.sh b/installer/mac/buildInstaller.sh index e3bc6597d..54ac0d373 100755 --- a/installer/mac/buildInstaller.sh +++ b/installer/mac/buildInstaller.sh @@ -2,7 +2,7 @@ # config releaseName="Brackets" -version="1.12" +version="1.13" dmgName="${releaseName} Release ${version}" format="bzip2" encryption="none" diff --git a/installer/win/brackets-win-install-build.xml b/installer/win/brackets-win-install-build.xml index 9216c3267..f1899ed02 100644 --- a/installer/win/brackets-win-install-build.xml +++ b/installer/win/brackets-win-install-build.xml @@ -12,7 +12,7 @@ default="build.mul"> - + diff --git a/package.json b/package.json index 671a22d66..e8dbf740e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Brackets-Shell", - "version": "1.12.0-0", + "version": "1.13.0-0", "homepage": "http://brackets.io", "issues": { "url": "http://github.com/adobe/brackets-shell/issues" From c71f6d5fd7a04df21f316ce95854bd091e0b6093 Mon Sep 17 00:00:00 2001 From: Prashanth Nethi Date: Thu, 1 Feb 2018 10:36:25 +0530 Subject: [PATCH 02/32] Restoring the brackets alias intitialization in appshell_extensions.js. This is still going to be required as brackets.app.language was getting accessed even before it was getting initialized in global.js. --- appshell/appshell_extensions.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/appshell/appshell_extensions.js b/appshell/appshell_extensions.js index ebfbf6155..76fe00256 100644 --- a/appshell/appshell_extensions.js +++ b/appshell/appshell_extensions.js @@ -939,11 +939,8 @@ if (!appshell.app) { appshell.app.getMachineHash = function (callback) { GetMachineHash(callback || _dummyCallback); }; - - - // Alias the appshell object to brackets. This is temporary and should be removed. - // The following is now moved to Global.js as newer versions of CEF crash upon - // eval of this statement. - //brackets = appshell; })(); + +// Alias the appshell object to brackets. This is temporary and should be removed. +var brackets = appshell; \ No newline at end of file From 641295365d83b1929c86cb7f23e5782a8ce9c7e1 Mon Sep 17 00:00:00 2001 From: Prashanth Nethi Date: Thu, 1 Feb 2018 12:51:12 +0530 Subject: [PATCH 03/32] Addressing review comments. --- appshell/appshell_extensions.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/appshell/appshell_extensions.js b/appshell/appshell_extensions.js index 76fe00256..032e58495 100644 --- a/appshell/appshell_extensions.js +++ b/appshell/appshell_extensions.js @@ -27,7 +27,7 @@ // Note: All file native file i/o functions are synchronous, but are exposed // here as asynchronous calls. -var appshell; +var appshell, brackets; if (!appshell) { appshell = {}; } @@ -37,6 +37,9 @@ if (!appshell.fs) { if (!appshell.app) { appshell.app = {}; } +if (!brackets) { + brackets = appshell; +} (function () { // Error values. These MUST be in sync with the error values // at the top of appshell_extensions_platform.h. @@ -941,6 +944,3 @@ if (!appshell.app) { }; })(); - -// Alias the appshell object to brackets. This is temporary and should be removed. -var brackets = appshell; \ No newline at end of file From be6d2606e8b709febb96c3a1b9e56a06b32ad440 Mon Sep 17 00:00:00 2001 From: Prashanth Nethi Date: Thu, 1 Feb 2018 12:52:45 +0530 Subject: [PATCH 04/32] Update appshell_extensions.js Updating comments --- appshell/appshell_extensions.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appshell/appshell_extensions.js b/appshell/appshell_extensions.js index 032e58495..c75019b91 100644 --- a/appshell/appshell_extensions.js +++ b/appshell/appshell_extensions.js @@ -37,6 +37,8 @@ if (!appshell.fs) { if (!appshell.app) { appshell.app = {}; } + +// Alias the appshell object to brackets. This is temporary and should be removed. if (!brackets) { brackets = appshell; } From e9550be718fbff570a68bd8e4b09e52e48b8ba33 Mon Sep 17 00:00:00 2001 From: Prashanth Nethi Date: Thu, 1 Feb 2018 13:16:35 +0530 Subject: [PATCH 05/32] Merge pull request #630 from adobe/nethip/FixLangSwitchIssue (#631) Restoring the brackets alias intitialization in appshell_extensions.js --- appshell/appshell_extensions.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/appshell/appshell_extensions.js b/appshell/appshell_extensions.js index ebfbf6155..c75019b91 100644 --- a/appshell/appshell_extensions.js +++ b/appshell/appshell_extensions.js @@ -27,7 +27,7 @@ // Note: All file native file i/o functions are synchronous, but are exposed // here as asynchronous calls. -var appshell; +var appshell, brackets; if (!appshell) { appshell = {}; } @@ -37,6 +37,11 @@ if (!appshell.fs) { if (!appshell.app) { appshell.app = {}; } + +// Alias the appshell object to brackets. This is temporary and should be removed. +if (!brackets) { + brackets = appshell; +} (function () { // Error values. These MUST be in sync with the error values // at the top of appshell_extensions_platform.h. @@ -939,11 +944,5 @@ if (!appshell.app) { appshell.app.getMachineHash = function (callback) { GetMachineHash(callback || _dummyCallback); }; - - - // Alias the appshell object to brackets. This is temporary and should be removed. - // The following is now moved to Global.js as newer versions of CEF crash upon - // eval of this statement. - //brackets = appshell; })(); From 67abaa35600061fb13e491581a32b28100cbefe9 Mon Sep 17 00:00:00 2001 From: Swagatam Mitra Date: Fri, 2 Feb 2018 18:29:57 +0530 Subject: [PATCH 06/32] Add maintenance version (#632) --- installer/win/brackets-win-install-build.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installer/win/brackets-win-install-build.xml b/installer/win/brackets-win-install-build.xml index 9216c3267..744b0aba0 100644 --- a/installer/win/brackets-win-install-build.xml +++ b/installer/win/brackets-win-install-build.xml @@ -13,7 +13,8 @@ default="build.mul"> - + + From 40c9ca7eee49e301a60ea55b299d8e04934096cb Mon Sep 17 00:00:00 2001 From: pelatx Date: Mon, 19 Feb 2018 02:08:38 +0100 Subject: [PATCH 07/32] Checked menu entries working. --- appshell/appshell_extensions_gtk.cpp | 35 +++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/appshell/appshell_extensions_gtk.cpp b/appshell/appshell_extensions_gtk.cpp index f101c513e..98b99dd6b 100644 --- a/appshell/appshell_extensions_gtk.cpp +++ b/appshell/appshell_extensions_gtk.cpp @@ -1100,7 +1100,6 @@ int32 GetMenuItemState(CefRefPtr browser, ExtensionString commandId, int32 SetMenuItemState(CefRefPtr browser, ExtensionString command, bool& enabled, bool& checked) { - // TODO: Implement functionality for checked NativeMenuModel& model = NativeMenuModel::getInstance(getMenuParent(browser)); int tag = model.getTag(command); if (tag == kTagNotFound) { @@ -1108,6 +1107,40 @@ int32 SetMenuItemState(CefRefPtr browser, ExtensionString command, b } GtkWidget* menuItem = (GtkWidget*) model.getOsItem(tag); gtk_widget_set_sensitive(menuItem, enabled); + + // Functionality for checked + gint position; + GtkWidget* checkedMenuItem; + GtkWidget* parent = gtk_widget_get_parent(menuItem); + + if (GTK_IS_CONTAINER(parent)) { + GList* children = gtk_container_get_children(GTK_CONTAINER(parent)); + gint index = 0; + do { + GtkWidget* widget = (GtkWidget*) children->data; + if (widget == menuItem) + position = index + 1; + if (index == position && GTK_IS_CHECK_MENU_ITEM(widget)) + checkedMenuItem = widget; + index++; + } while ((children = g_list_next(children)) != NULL); + g_list_free(children); + } + + if (checked == true) { + const gchar* label = gtk_menu_item_get_label(GTK_MENU_ITEM(menuItem)); + checkedMenuItem = gtk_check_menu_item_new_with_label(label); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(checkedMenuItem), true); + gtk_widget_set_sensitive(checkedMenuItem, enabled); + g_signal_connect(checkedMenuItem, "activate", G_CALLBACK(CheckedItemCallbach), menuItem); + gtk_menu_shell_insert(GTK_MENU_SHELL(parent), checkedMenuItem, position); + gtk_widget_show(checkedMenuItem); + gtk_widget_hide(menuItem); + } else { + gtk_widget_show(menuItem); + if (GTK_IS_WIDGET(checkedMenuItem)) + gtk_widget_destroy(checkedMenuItem); + } return NO_ERROR; } From e3f6e007f0e193b51e948050038cf995aa58eb63 Mon Sep 17 00:00:00 2001 From: pelatx Date: Mon, 19 Feb 2018 02:33:39 +0100 Subject: [PATCH 08/32] Forgotten callback for checked entry functionality. --- appshell/appshell_extensions_gtk.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/appshell/appshell_extensions_gtk.cpp b/appshell/appshell_extensions_gtk.cpp index 98b99dd6b..0fcdba125 100644 --- a/appshell/appshell_extensions_gtk.cpp +++ b/appshell/appshell_extensions_gtk.cpp @@ -1098,6 +1098,10 @@ int32 GetMenuItemState(CefRefPtr browser, ExtensionString commandId, return NO_ERROR; } +void CheckedItemCallbach(GtkWidget* checkMenuItem, GtkWidget* originalMenuItem) { + gtk_menu_item_activate(GTK_MENU_ITEM(originalMenuItem)); +} + int32 SetMenuItemState(CefRefPtr browser, ExtensionString command, bool& enabled, bool& checked) { NativeMenuModel& model = NativeMenuModel::getInstance(getMenuParent(browser)); From 651d58780aae36235ad5ff1332d3804b25e1fdd8 Mon Sep 17 00:00:00 2001 From: pelatx Date: Wed, 21 Feb 2018 19:20:50 +0100 Subject: [PATCH 09/32] Fixes post insertion of new menu item between the original menu item and the checked one. --- appshell/appshell_extensions_gtk.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/appshell/appshell_extensions_gtk.cpp b/appshell/appshell_extensions_gtk.cpp index 0fcdba125..909d66aa9 100644 --- a/appshell/appshell_extensions_gtk.cpp +++ b/appshell/appshell_extensions_gtk.cpp @@ -1113,37 +1113,42 @@ int32 SetMenuItemState(CefRefPtr browser, ExtensionString command, b gtk_widget_set_sensitive(menuItem, enabled); // Functionality for checked - gint position; + gint checkedItemPos = -1; GtkWidget* checkedMenuItem; GtkWidget* parent = gtk_widget_get_parent(menuItem); + const gchar* label = gtk_menu_item_get_label(GTK_MENU_ITEM(menuItem)); if (GTK_IS_CONTAINER(parent)) { GList* children = gtk_container_get_children(GTK_CONTAINER(parent)); gint index = 0; do { GtkWidget* widget = (GtkWidget*) children->data; - if (widget == menuItem) - position = index + 1; - if (index == position && GTK_IS_CHECK_MENU_ITEM(widget)) + const gchar* widgetLabel = gtk_menu_item_get_label(GTK_MENU_ITEM(widget)); + if (widget == menuItem) { + checkedItemPos = index + 1; + } + if (index >= checkedItemPos && GTK_IS_CHECK_MENU_ITEM(widget) && strcmp(widgetLabel, label) == 0) { checkedMenuItem = widget; + break; + } index++; } while ((children = g_list_next(children)) != NULL); g_list_free(children); } if (checked == true) { - const gchar* label = gtk_menu_item_get_label(GTK_MENU_ITEM(menuItem)); checkedMenuItem = gtk_check_menu_item_new_with_label(label); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(checkedMenuItem), true); gtk_widget_set_sensitive(checkedMenuItem, enabled); g_signal_connect(checkedMenuItem, "activate", G_CALLBACK(CheckedItemCallbach), menuItem); - gtk_menu_shell_insert(GTK_MENU_SHELL(parent), checkedMenuItem, position); + gtk_menu_shell_insert(GTK_MENU_SHELL(parent), checkedMenuItem, checkedItemPos); gtk_widget_show(checkedMenuItem); gtk_widget_hide(menuItem); } else { gtk_widget_show(menuItem); - if (GTK_IS_WIDGET(checkedMenuItem)) + if (GTK_IS_CHECK_MENU_ITEM(checkedMenuItem)) { gtk_widget_destroy(checkedMenuItem); + } } return NO_ERROR; } From ca7da2192a6ca698beb54ce57cbc94616f9e85f0 Mon Sep 17 00:00:00 2001 From: pelatx Date: Fri, 23 Feb 2018 16:05:11 +0100 Subject: [PATCH 10/32] Fixes visual malfunction (can be seen unchecked) of the split view items when the one that is ckecked at that moment is clicked. --- appshell/appshell_extensions_gtk.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/appshell/appshell_extensions_gtk.cpp b/appshell/appshell_extensions_gtk.cpp index 909d66aa9..ead82be27 100644 --- a/appshell/appshell_extensions_gtk.cpp +++ b/appshell/appshell_extensions_gtk.cpp @@ -1098,8 +1098,12 @@ int32 GetMenuItemState(CefRefPtr browser, ExtensionString commandId, return NO_ERROR; } -void CheckedItemCallbach(GtkWidget* checkMenuItem, GtkWidget* originalMenuItem) { - gtk_menu_item_activate(GTK_MENU_ITEM(originalMenuItem)); +void CheckedItemCallback(GtkWidget* checkMenuItem, GtkWidget* originalMenuItem) { + if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkMenuItem))) { + gtk_menu_item_activate(GTK_MENU_ITEM(originalMenuItem)); + } else { + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(checkMenuItem), true); + } } int32 SetMenuItemState(CefRefPtr browser, ExtensionString command, bool& enabled, bool& checked) @@ -1140,7 +1144,7 @@ int32 SetMenuItemState(CefRefPtr browser, ExtensionString command, b checkedMenuItem = gtk_check_menu_item_new_with_label(label); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(checkedMenuItem), true); gtk_widget_set_sensitive(checkedMenuItem, enabled); - g_signal_connect(checkedMenuItem, "activate", G_CALLBACK(CheckedItemCallbach), menuItem); + g_signal_connect(checkedMenuItem, "activate", G_CALLBACK(CheckedItemCallback), menuItem); gtk_menu_shell_insert(GTK_MENU_SHELL(parent), checkedMenuItem, checkedItemPos); gtk_widget_show(checkedMenuItem); gtk_widget_hide(menuItem); From 5e6f8a282d8c2cfcb1124921ad0c78e72e103d54 Mon Sep 17 00:00:00 2001 From: pelatx Date: Sat, 24 Feb 2018 08:42:27 +0100 Subject: [PATCH 11/32] Check menu item is created the first time that SetMenuItemState() is called with checked flag to true and reutilized later. --- appshell/appshell_extensions_gtk.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/appshell/appshell_extensions_gtk.cpp b/appshell/appshell_extensions_gtk.cpp index ead82be27..f91560268 100644 --- a/appshell/appshell_extensions_gtk.cpp +++ b/appshell/appshell_extensions_gtk.cpp @@ -1141,17 +1141,19 @@ int32 SetMenuItemState(CefRefPtr browser, ExtensionString command, b } if (checked == true) { - checkedMenuItem = gtk_check_menu_item_new_with_label(label); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(checkedMenuItem), true); + if (GTK_IS_CHECK_MENU_ITEM(checkedMenuItem)) { + checkedMenuItem = gtk_check_menu_item_new_with_label(label); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(checkedMenuItem), true); + g_signal_connect(checkedMenuItem, "activate", G_CALLBACK(CheckedItemCallback), menuItem); + gtk_menu_shell_insert(GTK_MENU_SHELL(parent), checkedMenuItem, checkedItemPos); + } gtk_widget_set_sensitive(checkedMenuItem, enabled); - g_signal_connect(checkedMenuItem, "activate", G_CALLBACK(CheckedItemCallback), menuItem); - gtk_menu_shell_insert(GTK_MENU_SHELL(parent), checkedMenuItem, checkedItemPos); gtk_widget_show(checkedMenuItem); gtk_widget_hide(menuItem); } else { gtk_widget_show(menuItem); if (GTK_IS_CHECK_MENU_ITEM(checkedMenuItem)) { - gtk_widget_destroy(checkedMenuItem); + gtk_widget_hide(checkedMenuItem); } } return NO_ERROR; From c5e80e4be4424ac40445d86c36508f20826ca280 Mon Sep 17 00:00:00 2001 From: pelatx Date: Sun, 25 Feb 2018 06:47:16 +0100 Subject: [PATCH 12/32] Typo fix. --- appshell/appshell_extensions_gtk.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appshell/appshell_extensions_gtk.cpp b/appshell/appshell_extensions_gtk.cpp index f91560268..4d7ad4f6f 100644 --- a/appshell/appshell_extensions_gtk.cpp +++ b/appshell/appshell_extensions_gtk.cpp @@ -1141,7 +1141,7 @@ int32 SetMenuItemState(CefRefPtr browser, ExtensionString command, b } if (checked == true) { - if (GTK_IS_CHECK_MENU_ITEM(checkedMenuItem)) { + if (!GTK_IS_CHECK_MENU_ITEM(checkedMenuItem)) { checkedMenuItem = gtk_check_menu_item_new_with_label(label); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(checkedMenuItem), true); g_signal_connect(checkedMenuItem, "activate", G_CALLBACK(CheckedItemCallback), menuItem); From 24218ded336ea189e352e2ac176ed2e792f6d64a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20A=2E=20Mart=C3=ADnez?= Date: Fri, 2 Mar 2018 09:59:49 +0100 Subject: [PATCH 13/32] New approach that simplifies the code. --- appshell/appshell_extensions_gtk.cpp | 69 ++++++++++++---------------- 1 file changed, 29 insertions(+), 40 deletions(-) diff --git a/appshell/appshell_extensions_gtk.cpp b/appshell/appshell_extensions_gtk.cpp index 4d7ad4f6f..c05965ab5 100644 --- a/appshell/appshell_extensions_gtk.cpp +++ b/appshell/appshell_extensions_gtk.cpp @@ -1098,12 +1098,20 @@ int32 GetMenuItemState(CefRefPtr browser, ExtensionString commandId, return NO_ERROR; } -void CheckedItemCallback(GtkWidget* checkMenuItem, GtkWidget* originalMenuItem) { - if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkMenuItem))) { - gtk_menu_item_activate(GTK_MENU_ITEM(originalMenuItem)); - } else { - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(checkMenuItem), true); - } +int _getMenuItemPosition(GtkWidget* parent, GtkWidget* menuItem) +{ + GList* children = gtk_container_get_children(GTK_CONTAINER(parent)); + int index = 0; + do { + GtkWidget* widget = (GtkWidget*) children->data; + if (widget == menuItem) { + return index; + } + index++; + } while ((children = g_list_next(children)) != NULL); + g_list_free(children); + + return -1; } int32 SetMenuItemState(CefRefPtr browser, ExtensionString command, bool& enabled, bool& checked) @@ -1117,45 +1125,26 @@ int32 SetMenuItemState(CefRefPtr browser, ExtensionString command, b gtk_widget_set_sensitive(menuItem, enabled); // Functionality for checked - gint checkedItemPos = -1; - GtkWidget* checkedMenuItem; GtkWidget* parent = gtk_widget_get_parent(menuItem); + int position = _getMenuItemPosition(parent, menuItem); const gchar* label = gtk_menu_item_get_label(GTK_MENU_ITEM(menuItem)); - if (GTK_IS_CONTAINER(parent)) { - GList* children = gtk_container_get_children(GTK_CONTAINER(parent)); - gint index = 0; - do { - GtkWidget* widget = (GtkWidget*) children->data; - const gchar* widgetLabel = gtk_menu_item_get_label(GTK_MENU_ITEM(widget)); - if (widget == menuItem) { - checkedItemPos = index + 1; - } - if (index >= checkedItemPos && GTK_IS_CHECK_MENU_ITEM(widget) && strcmp(widgetLabel, label) == 0) { - checkedMenuItem = widget; - break; - } - index++; - } while ((children = g_list_next(children)) != NULL); - g_list_free(children); - } - + GtkWidget* newMenuItem; if (checked == true) { - if (!GTK_IS_CHECK_MENU_ITEM(checkedMenuItem)) { - checkedMenuItem = gtk_check_menu_item_new_with_label(label); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(checkedMenuItem), true); - g_signal_connect(checkedMenuItem, "activate", G_CALLBACK(CheckedItemCallback), menuItem); - gtk_menu_shell_insert(GTK_MENU_SHELL(parent), checkedMenuItem, checkedItemPos); - } - gtk_widget_set_sensitive(checkedMenuItem, enabled); - gtk_widget_show(checkedMenuItem); - gtk_widget_hide(menuItem); - } else { - gtk_widget_show(menuItem); - if (GTK_IS_CHECK_MENU_ITEM(checkedMenuItem)) { - gtk_widget_hide(checkedMenuItem); - } + newMenuItem = gtk_check_menu_item_new_with_label(label); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(newMenuItem), true); + } else if (checked == false){ + newMenuItem = gtk_menu_item_new_with_label(label); } + + gtk_widget_destroy(menuItem); + + InstallMenuHandler(newMenuItem, browser, tag); + model.setOsItem(tag, newMenuItem); + gtk_menu_shell_insert(GTK_MENU_SHELL(parent), newMenuItem, position); + gtk_widget_set_sensitive(newMenuItem, enabled); + gtk_widget_show(newMenuItem); + return NO_ERROR; } From d6834b403ccd65c3bd344e0d677ec79176788b91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20A=2E=20Mart=C3=ADnez?= Date: Sat, 3 Mar 2018 07:00:04 +0100 Subject: [PATCH 14/32] Removed unnecessary call to gtk_widget_set_sensitive(). --- appshell/appshell_extensions_gtk.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/appshell/appshell_extensions_gtk.cpp b/appshell/appshell_extensions_gtk.cpp index c05965ab5..3458971b9 100644 --- a/appshell/appshell_extensions_gtk.cpp +++ b/appshell/appshell_extensions_gtk.cpp @@ -1122,9 +1122,6 @@ int32 SetMenuItemState(CefRefPtr browser, ExtensionString command, b return ERR_NOT_FOUND; } GtkWidget* menuItem = (GtkWidget*) model.getOsItem(tag); - gtk_widget_set_sensitive(menuItem, enabled); - - // Functionality for checked GtkWidget* parent = gtk_widget_get_parent(menuItem); int position = _getMenuItemPosition(parent, menuItem); const gchar* label = gtk_menu_item_get_label(GTK_MENU_ITEM(menuItem)); @@ -1136,7 +1133,6 @@ int32 SetMenuItemState(CefRefPtr browser, ExtensionString command, b } else if (checked == false){ newMenuItem = gtk_menu_item_new_with_label(label); } - gtk_widget_destroy(menuItem); InstallMenuHandler(newMenuItem, browser, tag); From db7e018983348ad7ad989c6bda438da337f6fa00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20A=2E=20Mart=C3=ADnez?= Date: Thu, 8 Mar 2018 00:01:19 +0100 Subject: [PATCH 15/32] Added @nethip hack to avoid seeing the checkbox disabled in `No Split`, etc. And addressing review comments. --- appshell/appshell_extensions_gtk.cpp | 3 +- appshell/appshell_extensions_platform.h | 14 ++++++++ appshell/browser/root_window_gtk.cc | 44 ++++++++++++++++++++++--- 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/appshell/appshell_extensions_gtk.cpp b/appshell/appshell_extensions_gtk.cpp index 3458971b9..7f9152972 100644 --- a/appshell/appshell_extensions_gtk.cpp +++ b/appshell/appshell_extensions_gtk.cpp @@ -95,6 +95,8 @@ typedef char s8; +bool StMenuCommandSkipper::sSkipMenuCommand = false; + extern CefRefPtr g_handler; // Supported browsers (order matters): @@ -1109,7 +1111,6 @@ int _getMenuItemPosition(GtkWidget* parent, GtkWidget* menuItem) } index++; } while ((children = g_list_next(children)) != NULL); - g_list_free(children); return -1; } diff --git a/appshell/appshell_extensions_platform.h b/appshell/appshell_extensions_platform.h index b2cea7b51..843bbbc67 100644 --- a/appshell/appshell_extensions_platform.h +++ b/appshell/appshell_extensions_platform.h @@ -108,6 +108,20 @@ class CharSetEncode void operator()(std::string &contents); }; +#if defined(OS_LINUX) +class StMenuCommandSkipper { +public: + + StMenuCommandSkipper() { sSkipMenuCommand = true; } + ~StMenuCommandSkipper() { sSkipMenuCommand = false;} + + static bool GetMenuCmdSkipFlag () { return sSkipMenuCommand;} + +private: + static bool sSkipMenuCommand; +}; +#endif + #if defined(OS_MACOSX) || defined(OS_LINUX) void DecodeContents(std::string &contents, const std::string& encoding); #endif diff --git a/appshell/browser/root_window_gtk.cc b/appshell/browser/root_window_gtk.cc index d566bbdd3..60f66302e 100644 --- a/appshell/browser/root_window_gtk.cc +++ b/appshell/browser/root_window_gtk.cc @@ -601,13 +601,49 @@ void RootWindowGtk::MenubarSizeAllocated(GtkWidget* widget, self->menubar_height_ = allocation->height; } +// Brackets specific change. +// GTK is toggling the menu state just by +// clicking on the menu entry. So posting a task to undo that +// unwanted side effect. This is a @nethip hack. +void DelayedMenuMarkToggle(GtkWidget *menuItem){ + + if (GTK_IS_CHECK_MENU_ITEM(menuItem)) { + // It is important to make sure our MenuItemACtivated + // knows that we are only changing the state and not + // firing any command as such. + StMenuCommandSkipper skipCmd; + + // Get the current state of the menu. + gboolean menuState = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuItem)); + + // Now go about toggling the state. If Brackets is triggering a menu state change, + // that will get executed later than DelayedMenuMarkToggle, as this task would have been + // posted prior to shell call to fire a command, so need not worry about this function + // getting executed after the shell call. + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuItem), !menuState); + } +} + // static gboolean RootWindowGtk::MenuItemActivated(GtkWidget* widget, RootWindowGtk* self) { - // Retrieve the menu ID set in AddMenuEntry. - int tag = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), kMenuIdKey)); - if (self && self->browser_window_) - self->browser_window_->DispatchCommandToBrowser(self->GetBrowser(), tag); + // Since we have migrated to checked menu items, setting the + // state of the menu is triggering a menu activation. So made + // sure we actually execute a command only when is menu is + // actually activated by the user and not when setting the menu + // state. + if(!StMenuCommandSkipper::GetMenuCmdSkipFlag()){ + + // Post a message to undo the undesired menu state change. + // See the comments above for explanation. + CefPostTask(TID_UI, base::Bind(&DelayedMenuMarkToggle, widget)); + + // Retrieve the menu ID set in AddMenuEntry. + int tag = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), kMenuIdKey)); + if (self && self->browser_window_) + self->browser_window_->DispatchCommandToBrowser(self->GetBrowser(), tag); + } + } // static From 5d821c02ad4d283daa80e6eaa7fec3122c162878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20A=2E=20Mart=C3=ADnez?= Date: Thu, 8 Mar 2018 09:39:59 +0100 Subject: [PATCH 16/32] Added some checks addressing review comments. --- appshell/appshell_extensions_gtk.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/appshell/appshell_extensions_gtk.cpp b/appshell/appshell_extensions_gtk.cpp index 7f9152972..43136c475 100644 --- a/appshell/appshell_extensions_gtk.cpp +++ b/appshell/appshell_extensions_gtk.cpp @@ -1123,8 +1123,17 @@ int32 SetMenuItemState(CefRefPtr browser, ExtensionString command, b return ERR_NOT_FOUND; } GtkWidget* menuItem = (GtkWidget*) model.getOsItem(tag); + if (menuItem == NULL) { + return ERR_UNKNOWN; + } GtkWidget* parent = gtk_widget_get_parent(menuItem); + if (parent == NULL) { + return ERR_UNKNOWN; + } int position = _getMenuItemPosition(parent, menuItem); + if (position < 0) { + return ERR_UNKNOWN; + } const gchar* label = gtk_menu_item_get_label(GTK_MENU_ITEM(menuItem)); GtkWidget* newMenuItem; From b88b6698d66cbcb1b5174c7d948ed5c328cabcd6 Mon Sep 17 00:00:00 2001 From: Prashanth Nethi Date: Wed, 4 Apr 2018 14:17:00 +0530 Subject: [PATCH 17/32] Reverting the file reading to the older format as the older approach seems better than the newer approach. Also this will resolve the crash on opening a file that is being exclusively held by other process. --- appshell/appshell_extensions_win.cpp | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/appshell/appshell_extensions_win.cpp b/appshell/appshell_extensions_win.cpp index 3e35c653a..e5666fa7f 100644 --- a/appshell/appshell_extensions_win.cpp +++ b/appshell/appshell_extensions_win.cpp @@ -913,26 +913,6 @@ std::wstring StringToWString(const std::string& str) return converterX.from_bytes(str); } -class ReadFileHandle { - HANDLE hFile; -public: - ReadFileHandle(const std::wstring& filename) { - hFile = CreateFile(filename.c_str(), GENERIC_READ, - FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (INVALID_HANDLE_VALUE == hFile) - throw "Could not initialize read handle"; - } - ~ReadFileHandle() { - if (hFile) - CloseHandle(hFile); - } - operator HANDLE() { - return hFile; - } -}; - - - int32 ReadFile(ExtensionString filename, ExtensionString& encoding, std::string& contents, bool& preserveBOM) { if (encoding == L"utf8") { @@ -946,10 +926,13 @@ int32 ReadFile(ExtensionString filename, ExtensionString& encoding, std::string& if (dwAttr & FILE_ATTRIBUTE_DIRECTORY) return ERR_CANT_READ; - ReadFileHandle readFileHandle(filename); - HANDLE hFile = readFileHandle; + HANDLE hFile = CreateFile(filename.c_str(), GENERIC_READ, + FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); int32 error = NO_ERROR; + if (INVALID_HANDLE_VALUE == hFile) + return ConvertWinErrorCode(GetLastError()); + DWORD dwFileSize = GetFileSize(hFile, NULL); if (dwFileSize == 0) { @@ -1027,6 +1010,7 @@ int32 ReadFile(ExtensionString filename, ExtensionString& encoding, std::string& } } } + CloseHandle(hFile); return error; } From 964cafdd436ba57fd7e97cfd70c9751684044284 Mon Sep 17 00:00:00 2001 From: Sorab Bisht Date: Fri, 13 Apr 2018 16:55:28 +0530 Subject: [PATCH 18/32] Fix the issue of resizing in multiple monitors (#638) --- appshell/cef_dark_aero_window.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/appshell/cef_dark_aero_window.cpp b/appshell/cef_dark_aero_window.cpp index 039a12f4c..f031ee5e4 100644 --- a/appshell/cef_dark_aero_window.cpp +++ b/appshell/cef_dark_aero_window.cpp @@ -843,6 +843,10 @@ LRESULT cef_dark_aero_window::WindowProc(UINT message, WPARAM wParam, LPARAM lPa return 0L; } break; + case WM_NCPAINT: + if (HandleNcPaint((HRGN)wParam)) + return 0L; + break; } // call DefWindowProc? From d22ab4c4dade1c458fa37fc0dc7b6b861e5cfbc3 Mon Sep 17 00:00:00 2001 From: pelatx Date: Tue, 17 Apr 2018 09:52:50 +0200 Subject: [PATCH 19/32] Linux native menus lost shortcuts (#637) * Initial commit. Some shortcuts still not seen. * Shorcuts return (to Linux native menus) * Indentation fix. * More indentation fixes. --- appshell/appshell_extensions_gtk.cpp | 14 +++++++++----- appshell/native_menu_model.cpp | 16 ++++++++++++++++ appshell/native_menu_model.h | 11 +++++------ 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/appshell/appshell_extensions_gtk.cpp b/appshell/appshell_extensions_gtk.cpp index 43136c475..77bf201fe 100644 --- a/appshell/appshell_extensions_gtk.cpp +++ b/appshell/appshell_extensions_gtk.cpp @@ -1064,6 +1064,7 @@ int32 AddMenuItem(CefRefPtr browser, ExtensionString parentCommand, ExtensionString commandId = model.getCommandId(tag); model.setOsItem(tag, entry); + model.setKey(tag, key); ParseShortcut(browser, entry, key, commandId); GtkWidget* menuHeader = (GtkWidget*) model.getOsItem(parentTag); GtkWidget* menuWidget = gtk_menu_item_get_submenu(GTK_MENU_ITEM(menuHeader)); @@ -1140,13 +1141,16 @@ int32 SetMenuItemState(CefRefPtr browser, ExtensionString command, b if (checked == true) { newMenuItem = gtk_check_menu_item_new_with_label(label); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(newMenuItem), true); - } else if (checked == false){ + } else { newMenuItem = gtk_menu_item_new_with_label(label); } gtk_widget_destroy(menuItem); InstallMenuHandler(newMenuItem, browser, tag); + model.setOsItem(tag, newMenuItem); + ExtensionString key = model.getKey(tag); + ParseShortcut(browser, newMenuItem, key, command); gtk_menu_shell_insert(GTK_MENU_SHELL(parent), newMenuItem, position); gtk_widget_set_sensitive(newMenuItem, enabled); gtk_widget_show(newMenuItem); @@ -1191,13 +1195,15 @@ int32 GetMenuTitle(CefRefPtr browser, ExtensionString commandId, Ext int32 SetMenuItemShortcut(CefRefPtr browser, ExtensionString commandId, ExtensionString shortcut, ExtensionString displayStr) { - NativeMenuModel model = NativeMenuModel::getInstance(getMenuParent(browser)); - int32 tag = model.getTag(commandId); + NativeMenuModel& model = NativeMenuModel::getInstance(getMenuParent(browser)); + int tag = model.getTag(commandId); if (tag == kTagNotFound) { return ERR_NOT_FOUND; } GtkWidget* entry = (GtkWidget*) model.getOsItem(tag); + model.setKey(tag, shortcut); ParseShortcut(browser, entry, shortcut, commandId); + return NO_ERROR; } @@ -1396,5 +1402,3 @@ std::string GetSystemUniqueID() return buf; } - - diff --git a/appshell/native_menu_model.cpp b/appshell/native_menu_model.cpp index 4ccd98a43..59191833d 100644 --- a/appshell/native_menu_model.cpp +++ b/appshell/native_menu_model.cpp @@ -97,6 +97,22 @@ ExtensionString NativeMenuModel::getParentId(int tag) { return menuItems[tag].parentId; } +ExtensionString NativeMenuModel::getKey(int tag) { + menu::iterator foundItem = menuItems.find(tag); + if(foundItem == menuItems.end()) { + return ExtensionString(); + } + return menuItems[tag].key; +} + +void NativeMenuModel::setKey (int tag, ExtensionString theKey) { + menu::iterator foundItem = menuItems.find(tag); + if(foundItem == menuItems.end()) { + return; + } + menuItems[tag].key = theKey; +} + int NativeMenuModel::getOrCreateTag(ExtensionString command, ExtensionString parent) { menuTag::iterator foundItem = commandMap.find(command); diff --git a/appshell/native_menu_model.h b/appshell/native_menu_model.h index 72892d1e7..fe3013887 100644 --- a/appshell/native_menu_model.h +++ b/appshell/native_menu_model.h @@ -46,7 +46,8 @@ class NativeMenuItemModel enabled(enabled), osItem(NULL), commandId(commandId), - parentId(parentId) + parentId(parentId), + key(ExtensionString()) { } bool checked; @@ -54,6 +55,7 @@ class NativeMenuItemModel void *osItem; ExtensionString commandId; ExtensionString parentId; + ExtensionString key; }; //command name -> menutag @@ -91,13 +93,10 @@ class NativeMenuModel { int setTag(ExtensionString command, ExtensionString parent, int tag); ExtensionString getCommandId(int tag); ExtensionString getParentId(int tag); + ExtensionString getKey(int tag); + void setKey(int tag, ExtensionString theKey); void setOsItem (int tag, void* theItem); void* getOsItem (int tag); int removeMenuItem(const ExtensionString& command); }; - - - - - From cb6ab771b0c57fa3df838982eb22a89a17a6a587 Mon Sep 17 00:00:00 2001 From: Bhavika Miglani Date: Wed, 18 Apr 2018 13:14:26 +0530 Subject: [PATCH 20/32] Auto Update Framework (#634) * XLST Change * Revert "XLST Change" This reverts commit 09199fcec1a5e035cce1990f58b1f970d3d3f088. * Updating checkbox to accept CLI Inputs * Auto updater changes * Renamed custom action projects, added build process for DLLs * Renaming config files to match required convention for Wix. Note: The config flie HAS to be named CustomAction.config else Wix ignores it * Updating error log in custom action * Adding back Exit Dialog UI * AutoUpdate Framework : Initial Changes * Adding update script for MAC * Updating buildinstaller.sh to add update.sh to the installer Also modified update.sh to be an executable(using chmod), so that it can be run as a script * Fixing incorrect invocation * Modifying DropDMG layout to include .update.sh This should fix the issue where the dmg windwow looks wrong on mounting it * Error handling, and code cleanup changes * Explicitly setting execute permission on update.sh as part of the dmg creation * Fixing a typo in the dmg creation script * Error handling, and code cleanup * Fixing indentation * Addressing review comments, making autoUpdate no-op on Linux * Adding a license to the top of the Windows customaction files --- .gitignore | 1 - Gruntfile.js | 13 + appshell/appshell_extensions.cpp | 17 +- appshell/appshell_extensions.js | 15 +- appshell/appshell_extensions_platform.h | 1 + appshell/cefclient_mac.mm | 4 + appshell/cefclient_win.cpp | 4 + appshell/update.cpp | 65 +++++ appshell/update.h | 46 ++++ appshell/update_mac.mm | 226 ++++++++++++++++ appshell/update_win.cpp | 175 ++++++++++++ appshell_paths.gypi | 4 + installer/mac/buildInstaller.sh | 7 + .../layouts/bracketsLayout/Info.plist | 10 + installer/mac/update.sh | 255 ++++++++++++++++++ installer/win/Brackets.wxs | 75 +++++- .../BracketsConfigurator.cs | 90 +++++++ .../BracketsConfigurator.csproj | 53 ++++ .../BracketsConfigurator/CustomAction.config | 32 +++ .../Properties/AssemblyInfo.cs | 35 +++ .../BracketsConfiguratorSolution.sln | 22 ++ .../LaunchBrackets/CustomAction.config | 32 +++ .../LaunchBrackets/LaunchBrackets.cs | 53 ++++ .../LaunchBrackets/LaunchBrackets.csproj | 53 ++++ .../LaunchBrackets/Properties/AssemblyInfo.cs | 35 +++ .../LaunchBrackets/LaunchBracketsSolution.sln | 22 ++ scripts/brackets_installer_projects.bat | 39 +++ tasks/build.js | 3 +- 28 files changed, 1375 insertions(+), 12 deletions(-) create mode 100644 appshell/update.cpp create mode 100644 appshell/update.h create mode 100644 appshell/update_mac.mm create mode 100644 appshell/update_win.cpp create mode 100755 installer/mac/update.sh create mode 100644 installer/win/BracketsConfigurator/BracketsConfigurator/BracketsConfigurator.cs create mode 100644 installer/win/BracketsConfigurator/BracketsConfigurator/BracketsConfigurator.csproj create mode 100644 installer/win/BracketsConfigurator/BracketsConfigurator/CustomAction.config create mode 100644 installer/win/BracketsConfigurator/BracketsConfigurator/Properties/AssemblyInfo.cs create mode 100644 installer/win/BracketsConfigurator/BracketsConfiguratorSolution.sln create mode 100644 installer/win/LaunchBrackets/LaunchBrackets/CustomAction.config create mode 100644 installer/win/LaunchBrackets/LaunchBrackets/LaunchBrackets.cs create mode 100644 installer/win/LaunchBrackets/LaunchBrackets/LaunchBrackets.csproj create mode 100644 installer/win/LaunchBrackets/LaunchBrackets/Properties/AssemblyInfo.cs create mode 100644 installer/win/LaunchBrackets/LaunchBracketsSolution.sln create mode 100644 scripts/brackets_installer_projects.bat diff --git a/.gitignore b/.gitignore index c7580fb76..d2cf15e7e 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ xcodebuild/* *.vcxproj *.vcxproj.filters *.vcxproj.user -*.sln *.pbxuser *.perspective diff --git a/Gruntfile.js b/Gruntfile.js index 3335e0664..2603d6977 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -192,6 +192,19 @@ module.exports = function (grunt) { } ] }, + "winInstallerDLLs": { + "files": [ + { + "flatten" : true, + "expand" : true, + "src" : [ + "installer/win/LaunchBrackets/LaunchBrackets/bin/Release/LaunchBrackets.CA.dll", + "installer/win/BracketsConfigurator/BracketsConfigurator/bin/Release/BracketsConfigurator.CA.dll" + ], + "dest" : "installer/win/" + } + ] + }, "mac": { "files": [ { diff --git a/appshell/appshell_extensions.cpp b/appshell/appshell_extensions.cpp index 38a44ac8b..c5ac80bd8 100644 --- a/appshell/appshell_extensions.cpp +++ b/appshell/appshell_extensions.cpp @@ -34,6 +34,7 @@ #endif #include +#include "update.h" extern std::vector gDroppedFiles; @@ -507,7 +508,21 @@ class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate { error = CopyFile(src, dest); // No additional response args for this function } - } else if (message_name == "GetDroppedFiles") { + } else if (message_name == "SetUpdateParams") { + // Parameters: + // 0: int32 - callback id + // 1: string - update parameters json object + + size_t numArgs = argList->GetSize(); + if (numArgs < 2 || + argList->GetType(1) != VTYPE_STRING) { + error = ERR_INVALID_PARAMS; + } + if(error == NO_ERROR){ + CefString updateJson = argList->GetString(1); + error = SetInstallerCommandLineArgs(updateJson); + } + } else if (message_name == "GetDroppedFiles") { // Parameters: // 0: int32 - callback id if (argList->GetSize() != 1) { diff --git a/appshell/appshell_extensions.js b/appshell/appshell_extensions.js index c75019b91..fc161e6e4 100644 --- a/appshell/appshell_extensions.js +++ b/appshell/appshell_extensions.js @@ -643,7 +643,20 @@ if (!brackets) { appshell.app.getRemoteDebuggingPort = function () { return GetRemoteDebuggingPort(); }; - + + + /** + * Set the parameters for auto update, to be used by installer on Win/Update Script on Mac as command line arguments. + * + * @param {string} updateInfoObj - update info json object + * @param {function(err)=} callback Asynchronous callback function. + * @return None. + */ + native function SetUpdateParams(); + appshell.app.setUpdateParams = function (updateInfoObj, callback) { + SetUpdateParams(callback || _dummyCallback, updateInfoObj); + } + /** * Set menu enabled/checked state. * @param {string} command ID of the menu item. diff --git a/appshell/appshell_extensions_platform.h b/appshell/appshell_extensions_platform.h index 843bbbc67..405628e0c 100644 --- a/appshell/appshell_extensions_platform.h +++ b/appshell/appshell_extensions_platform.h @@ -60,6 +60,7 @@ static const int ERR_CL_TOOLS_NOTSUPPORTED = 17; static const int ERR_ENCODE_FILE_FAILED = 18; static const int ERR_DECODE_FILE_FAILED = 19; static const int ERR_UNSUPPORTED_UTF16_ENCODING = 20; +static const int ERR_UPDATE_ARGS_INIT_FAILED = 21; static const int ERR_PID_NOT_FOUND = -9999; // negative int to avoid confusion with real PIDs diff --git a/appshell/cefclient_mac.mm b/appshell/cefclient_mac.mm index 26447001f..d588bbd30 100644 --- a/appshell/cefclient_mac.mm +++ b/appshell/cefclient_mac.mm @@ -7,6 +7,7 @@ #import #include #include "cefclient.h" +#include "update.h" #include "include/cef_app.h" #include "include/cef_version.h" #import "include/cef_application_mac.h" @@ -730,6 +731,9 @@ - (void)applicationWillTerminate:(NSNotification *)aNotification { g_handler = NULL; CefShutdown(); + //Run the app auto update + RunAppUpdate(); + [self release]; // Release the AutoRelease pool. diff --git a/appshell/cefclient_win.cpp b/appshell/cefclient_win.cpp index e09473752..a53ceb07a 100644 --- a/appshell/cefclient_win.cpp +++ b/appshell/cefclient_win.cpp @@ -28,6 +28,7 @@ #include "cef_registry.h" #include "cef_main_window.h" +#include "update.h" // Global Variables: DWORD g_appStartupTime; @@ -326,6 +327,9 @@ int APIENTRY wWinMain(HINSTANCE hInstance, // Shut down CEF. CefShutdown(); + // Run the app auto update + RunAppUpdate(); + // release the first instance mutex if (hMutex != NULL) ReleaseMutex(hMutex); diff --git a/appshell/update.cpp b/appshell/update.cpp new file mode 100644 index 000000000..e3fc06acd --- /dev/null +++ b/appshell/update.cpp @@ -0,0 +1,65 @@ + +/* + * Copyright (c) 2018 - present Adobe Systems Incorporated. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +// This file contains the implementation for functions common to Win and Mac Auto Update. + +#include "update.h" + + +#if defined(OS_LINUX) + +//In Linux, all the shell side functions will be no-op for now + +int32 ParseCommandLineParamsJSON(CefString &updateArgs, CefRefPtr &argsDict) { return NO_ERROR; } + +int32 SetInstallerCommandLineArgs(CefString &updateArgs) { return NO_ERROR; } + +int32 RunAppUpdate() { return NO_ERROR; } + +#else + +// Parses the update parameters json from a cef string to a cef dictionary +int32 ParseCommandLineParamsJSON(CefString &updateArgs, CefRefPtr &argsDict) +{ + if (updateArgs.length()) { + CefRefPtr argsJSON = CefParseJSON(updateArgs, JSON_PARSER_RFC); + if (argsJSON->IsValid()) + { + CefValueType argType = argsJSON->GetType(); + if (argType == VTYPE_DICTIONARY) + { + CefRefPtr argsDictionary = argsJSON->GetDictionary(); + if (argsDictionary) + { + argsDict = argsDictionary; + return NO_ERROR; + } + } + } + + } + return ERR_UPDATE_ARGS_INIT_FAILED; +} + +#endif //OS_LINUX \ No newline at end of file diff --git a/appshell/update.h b/appshell/update.h new file mode 100644 index 000000000..0379a5ced --- /dev/null +++ b/appshell/update.h @@ -0,0 +1,46 @@ + +/* + * Copyright (c) 2018 - present Adobe Systems Incorporated. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +// The header file containing the core logic of handling auto update. + +#pragma once +#include "appshell_extensions_platform.h" +#include "include/cef_parser.h" + + +// Parses the update parameters json from a cef string to a cef dictionary +int32 ParseCommandLineParamsJSON(CefString &updateArgs, CefRefPtr &argsDict); + +// Sets the command line arguments to the installer on Win and update script on Mac +int32 SetInstallerCommandLineArgs(CefString &updateArgs); + +// Runs the app auto update +int32 RunAppUpdate(); + + + + + + + diff --git a/appshell/update_mac.mm b/appshell/update_mac.mm new file mode 100644 index 000000000..0091cd35c --- /dev/null +++ b/appshell/update_mac.mm @@ -0,0 +1,226 @@ + +/* + * Copyright (c) 2018 - present Adobe Systems Incorporated. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +// This file contains the core logic of handling auto update on MAC. + + +#import +#include "update.h" + +//Helper class for app auto update +@interface UpdateHelper : NSObject + ++ (BOOL) launchInstaller; ++ (NSMutableDictionary *) params; + ++ (void) setLaunchInstaller:(BOOL)shouldlaunchInstaller; ++ (void) setParams:(NSMutableDictionary *)params; + ++ (void) RunAppUpdate; ++ (int) getCurrentProcessID; ++ (BOOL) createFileItNotExists:(NSString *)filePath; +@end + + +@implementation UpdateHelper + +static BOOL _launchInstaller; +static NSMutableDictionary * _params; + + ++ (BOOL) launchInstaller { + return _launchInstaller; +} + ++ (NSMutableDictionary *) params { + return _params; +} + +// Setter for boolean for conditional launch of installer ++ (void) setLaunchInstaller:(BOOL)shouldlaunchInstaller { + _launchInstaller = shouldlaunchInstaller; +} + +// Setter for update parameters ++ (void) setParams:(NSMutableDictionary *)params { + _params = params; +} + +// Runs a script, given the script path, and args array. +int RunScript(NSString* launchPath, NSArray* argsArray, BOOL waitUntilExit) +{ + int returnCode = -1; + if(launchPath) { + // Create a NSTask for the script + NSTask* pScriptTask = [[NSTask alloc] init]; + pScriptTask.launchPath = launchPath; + pScriptTask.arguments = argsArray; + + // Launch the script. + [pScriptTask launch]; + if(waitUntilExit) { + [pScriptTask waitUntilExit]; + returnCode = pScriptTask.terminationStatus; + } + [pScriptTask release]; + } + return returnCode; +} + +// Retrieves PID of the currently running instance of Brackets ++ (int) getCurrentProcessID { + + return [[NSProcessInfo processInfo] processIdentifier]; + +} + +// Creates a file with filePath, if does not exist ++ (BOOL) createFileItNotExists:(NSString *)filePath { + BOOL returnCode = TRUE; + if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) { + returnCode = [[NSFileManager defaultManager] createFileAtPath:filePath contents:nil attributes:nil]; + } + return returnCode; +} + +// Runs the app update ++ (void) RunAppUpdate{ + + if([UpdateHelper launchInstaller]) { + + NSString *mountPoint = @"/Volumes/BracketsAutoUpdate"; + + if (_params || [_params count] != 0) { + NSString *imagePath = _params[@"installerPath"]; + NSString *logFilePath = _params[@"logFilePath"]; + NSString *installStatusFilePath = _params[@"installStatusFilePath"]; + NSString *installDir = _params[@"installDir"]; + NSString *bracketsAppName = _params[@"appName"]; + NSString *updateDir = _params[@"updateDir"]; + + //Util paths + NSString* hdiPath = @"/usr/bin/hdiutil"; + NSString* shPath = @"/bin/sh"; + NSString* nohupPath = @"/usr/bin/nohup"; + + if ([hdiPath length] == 0 || [shPath length] == 0 || [nohupPath length] == 0 ) { + BOOL filePresent = [self createFileItNotExists:installStatusFilePath]; + if (filePresent) { + NSString *logStr; + if([hdiPath length] == 0 ) { + logStr = @"hdiutil command could not be found"; + [logStr writeToFile:installStatusFilePath atomically:YES encoding:NSUTF8StringEncoding error:nil]; + } + if([shPath length] == 0 ) { + logStr = @"sh command could not be found"; + [logStr writeToFile:installStatusFilePath atomically:YES encoding:NSUTF8StringEncoding error:nil]; + } + if([nohupPath length] == 0 ) { + logStr = @"nohupPath command could not be found"; + [logStr writeToFile:installStatusFilePath atomically:YES encoding:NSUTF8StringEncoding error:nil]; + } + } + + } + else { + // Unmount the already existing disk image, if any + NSArray* pArgs = [NSArray arrayWithObjects:@"detach", mountPoint, @"-force", nil]; + + int retval = RunScript(hdiPath, pArgs, true); + while (retval != 1) { + retval = RunScript(hdiPath, pArgs, true); + } + + // Mount the new disk image + pArgs = [NSArray arrayWithObjects:@"attach", imagePath, @"-mountpoint", mountPoint, @"-nobrowse", nil]; + + retval = RunScript(hdiPath, pArgs, true); + + // Run the update script present inside the dmg + if (!retval) { + + NSString *scriptPath = [mountPoint stringByAppendingString:@"/.update.sh"]; + + if (![[NSFileManager defaultManager] fileExistsAtPath:scriptPath]) { + BOOL filePresent = [self createFileItNotExists:installStatusFilePath]; + if (filePresent) { + NSString *logStr = @"update script could not be found"; + [logStr writeToFile:installStatusFilePath atomically:YES encoding:NSUTF8StringEncoding error:nil]; + } + } + else { + int pid = [self getCurrentProcessID]; + NSString* pidString = [NSString stringWithFormat:@"%d", pid]; + pArgs = [NSArray arrayWithObjects:shPath, scriptPath, @"-a", bracketsAppName, @"-b", installDir, @"-l", logFilePath, @"-m", mountPoint, @"-t", updateDir, @"-p", pidString, @"&", nil]; + + retval = RunScript(nohupPath, pArgs, false); + } + } + } + } + + } +} + +// Setter for update parametes ++ (void) SetUpdateArgs:(NSMutableDictionary *)dict { + [self setParams:dict]; +} +@end + +// Sets the command line arguments to the update script +int32 SetInstallerCommandLineArgs(CefString &updateArgs) +{ + CefRefPtr argsDict; + int32 error = ParseCommandLineParamsJSON(updateArgs, argsDict); + if(error == NO_ERROR && argsDict.get()) + { + ExtensionString installerPath = argsDict->GetString("installerPath").ToString(); + ExtensionString logFilePath = argsDict->GetString("logFilePath").ToString(); + ExtensionString installStatusFilePath = argsDict->GetString("installStatusFilePath").ToString(); + ExtensionString installDir = argsDict->GetString("installDir").ToString(); + ExtensionString appName = argsDict->GetString("appName").ToString(); + ExtensionString updateDir = argsDict->GetString("updateDir").ToString(); + + [UpdateHelper setLaunchInstaller:true]; + + NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; + [dict setObject:[NSString stringWithUTF8String:installerPath.c_str()] forKey:@"installerPath"]; + [dict setObject:[NSString stringWithUTF8String:logFilePath.c_str()] forKey:@"logFilePath"]; + [dict setObject:[NSString stringWithUTF8String:installStatusFilePath.c_str()] forKey:@"installStatusFilePath"]; + [dict setObject:[NSString stringWithUTF8String:installDir.c_str()] forKey:@"installDir"]; + [dict setObject:[NSString stringWithUTF8String:appName.c_str()] forKey:@"appName"]; + [dict setObject:[NSString stringWithUTF8String:updateDir.c_str()] forKey:@"updateDir"]; + + argsDict = NULL; + [UpdateHelper SetUpdateArgs:dict]; + } + return error; +} + +// Runs the app auto update +int32 RunAppUpdate(){ + [UpdateHelper RunAppUpdate]; + return NO_ERROR; +} diff --git a/appshell/update_win.cpp b/appshell/update_win.cpp new file mode 100644 index 000000000..75f1274fd --- /dev/null +++ b/appshell/update_win.cpp @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2018 - present Adobe Systems Incorporated. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +* +*/ + +#include "update.h" +#include "windows.h" +#include + +//Helper class for app auto update +class UpdateHelper { +private: + static bool m_blaunchInstaller; + static ExtensionString m_InstallerPath; //Path to the installer file + static ExtensionString m_logFilePath; // Path to the installer log file //AUTOUPDATE_PRERELEASE + static ExtensionString m_installStatusFilePath; // Path to the log file which logs errors which prevent the installer from running + +public: + void static SetInstallerPath(ExtensionString &path); + void static SetInstallStatusFilePath(ExtensionString &path); + void static SetlaunchInstaller(bool val); + void static SetLogFilePath(ExtensionString &logFilePath); //AUTOUPDATE_PRERELEASE + void static RunAppUpdate(); + void static SetUpdateArgs(ExtensionString &installerPath, ExtensionString &installStatusFilePath, ExtensionString &logFilePath); +}; + +bool UpdateHelper::m_blaunchInstaller; +ExtensionString UpdateHelper::m_InstallerPath; +ExtensionString UpdateHelper::m_logFilePath; +ExtensionString UpdateHelper::m_installStatusFilePath; + +// Runs the installer for app update +void UpdateHelper::RunAppUpdate() { + if (m_blaunchInstaller ) { + + std::wstring commandInput = L"msiexec /i " + m_InstallerPath + L" /qr"; + //AUTOUPDATE_PRERELEASE + if (!m_logFilePath.empty()) { + commandInput += L" /l*V " + m_logFilePath; + } + commandInput += L" LAUNCH_APPLICATION_SILENT=1 MSIFASTINSTALL=2"; + + const TCHAR* input = commandInput.c_str(); + TCHAR cmd[MAX_UNC_PATH]; + size_t nSize = _countof(cmd); + errno_t comspecEnv = _wgetenv_s(&nSize, cmd, L"COMSPEC"); + + // fp is a pointer to log file, which logs any errors encountered due to which installer could not be launched + FILE *fp = NULL; + if (comspecEnv == 0 && nSize != 0) + { + TCHAR cmdline[3*MAX_UNC_PATH]; + swprintf_s(cmdline, 3*MAX_UNC_PATH, L"%s /c %s", cmd, input); + + STARTUPINFOW startInf; + memset(&startInf, 0, sizeof startInf); + startInf.cb = sizeof(startInf); + + PROCESS_INFORMATION procInfo; + memset(&procInfo, 0, sizeof procInfo); + + //Create the installer process + BOOL installerProcess = CreateProcessW(NULL, cmdline, NULL, NULL, FALSE, CREATE_NEW_PROCESS_GROUP | CREATE_NO_WINDOW, NULL, NULL, &startInf, &procInfo); + if (!installerProcess && !m_installStatusFilePath.empty()) { + // Process could not be created successfully + DWORD err = GetLastError(); + fp = _wfopen(m_installStatusFilePath.c_str(), L"a+"); + if (fp != NULL) { + std::wstring errStr = std::to_wstring(err); + fwprintf(fp, L"Installer process could not be created successfully. Error : %s \n", errStr.c_str()); + } + } + } + else { + if (!m_installStatusFilePath.empty()) + { + fp = _wfopen(m_installStatusFilePath.c_str(), L"a+"); + if (comspecEnv != 0) + { + //Command line interpreter could not be fetched + if (fp != NULL) { + std::wstring comspecStr = std::to_wstring(comspecEnv); + fwprintf(fp, L"Command line interpreter could not be fetched from the current environment. Error : %s \n", comspecStr.c_str()); + } + } + else + { + //COMSPEC variable not found + if (fp != NULL) { + std::wstring nSizeStr = std::to_wstring(nSize); + fwprintf(fp, L"COMSPEC not found in the current environment. Error : %s \n", nSizeStr.c_str()); + } + } + } + } + if(fp != NULL) + fclose(fp); + } +} + +// Sets the Brackets installer path +void UpdateHelper::SetInstallerPath(ExtensionString &path) { + if (!path.empty()) { + SetlaunchInstaller(true); + m_InstallerPath = path; + } +} + +//Sets the command line arguments to installer +void UpdateHelper::SetUpdateArgs(ExtensionString &installerPath, ExtensionString &installStatusFilePath ,ExtensionString &logFilePath) +{ + SetInstallerPath(installerPath); + SetLogFilePath(logFilePath); + SetInstallStatusFilePath(installStatusFilePath); +} + +// Sets the installer log file path +void UpdateHelper::SetLogFilePath(ExtensionString &logFilePath) { + if (!logFilePath.empty()) { + m_logFilePath = logFilePath; + } +} + +// Sets the install status log file path, which logs any errors encountered due to which installer could not be run +void UpdateHelper::SetInstallStatusFilePath(ExtensionString &installStatusFilePath) { + if (!installStatusFilePath.empty()) { + m_installStatusFilePath = installStatusFilePath; + } +} +// Sets the boolean for conditional launch of Installer +void UpdateHelper::SetlaunchInstaller(bool launchInstaller) { + m_blaunchInstaller = launchInstaller; + if (!launchInstaller) { + m_InstallerPath.clear(); + } +} + +// Sets the command line arguments to the installer +int32 SetInstallerCommandLineArgs(CefString &updateArgs) { + CefRefPtr argsDict; + int32 error = ParseCommandLineParamsJSON(updateArgs, argsDict); + if (error == NO_ERROR && argsDict.get()) + { + ExtensionString installerPath = argsDict->GetString("installerPath").ToWString(); + ExtensionString logFilePath = argsDict->GetString("logFilePath").ToWString(); //AUTOUPDATE_PRERELEASE + ExtensionString installStatusFilePath = argsDict->GetString("installStatusFilePath").ToWString(); + UpdateHelper::SetUpdateArgs(installerPath, installStatusFilePath, logFilePath); + argsDict = NULL; + } + return error; +} + +// Runs the app auto update +int32 RunAppUpdate() { + UpdateHelper::RunAppUpdate(); + return NO_ERROR; +} \ No newline at end of file diff --git a/appshell_paths.gypi b/appshell_paths.gypi index 6a3db0601..3b14692a1 100755 --- a/appshell_paths.gypi +++ b/appshell_paths.gypi @@ -198,6 +198,8 @@ 'appshell_sources_common': [ 'appshell/cefclient.cpp', 'appshell/cefclient.h', + 'appshell/update.h', + 'appshell/update.cpp', '<@(appshell_sources_common_helper)', ], 'appshell_sources_common_linux': [ @@ -243,6 +245,7 @@ 'appshell/cef_registry.h', 'appshell/cef_window.cpp', 'appshell/cef_window.h', + 'appshell/update_win.cpp', 'appshell/res/close-hover.png', 'appshell/res/close.png', 'appshell/res/max-hover.png', @@ -283,6 +286,7 @@ 'appshell/appshell_helpers_mac.mm', 'appshell/cefclient_mac.mm', 'appshell/client_handler_mac.mm', + 'appshell/update_mac.mm', '<@(appshell_sources_browser)', '<@(appshell_sources_common)', ], diff --git a/installer/mac/buildInstaller.sh b/installer/mac/buildInstaller.sh index 54ac0d373..7cfb4c72b 100755 --- a/installer/mac/buildInstaller.sh +++ b/installer/mac/buildInstaller.sh @@ -15,6 +15,13 @@ rm -rf $tempDir mkdir $tempDir cp -r "./staging/${BRACKETS_APP_NAME}.app/" "$tempDir/$appName" +# copy update.sh to hidden location in the dmg +if [ -f ./update.sh ]; then + echo "Adding update.sh" + chmod +x ./update.sh + cp ./update.sh "$tempDir/.update.sh" +fi + # create symlink to Applications folder in staging area # with a single space as the name so it doesn't show an unlocalized name ln -s /Applications "$tempDir/ " diff --git a/installer/mac/dropDmgConfig/layouts/bracketsLayout/Info.plist b/installer/mac/dropDmgConfig/layouts/bracketsLayout/Info.plist index a31d731a1..49d108063 100644 --- a/installer/mac/dropDmgConfig/layouts/bracketsLayout/Info.plist +++ b/installer/mac/dropDmgConfig/layouts/bracketsLayout/Info.plist @@ -46,6 +46,16 @@ type file + + identifier + LayoutItem.3E1B7344-C175-4BE0-87DB-880A4A30E80F + name + .update.sh + position + {228, 424} + type + file + identifier LayoutItem.0679B008-641D-4857-A4B8-156BF67D8320 diff --git a/installer/mac/update.sh b/installer/mac/update.sh new file mode 100755 index 000000000..62d4da655 --- /dev/null +++ b/installer/mac/update.sh @@ -0,0 +1,255 @@ +#!/bin/sh + +EMPTY_STRING="" + +APP_NAME=$EMPTY_STRING +APP_DIR=$EMPTY_STRING +LOG_FILE=$EMPTY_STRING +MOUNT_POINT=$EMPTY_STRING +TEMP_DIR=$EMPTY_STRING +PID=$EMPTY_STRING + +#Return value codes +SUCCESS=0 +OPTIONS_MISSING=1 + +# Logs info messages into log file +function printInfo(){ + currentTime=$(date) + echo "$currentTime $1" >> $LOG_FILE + return 0 +} + +# Logs warning messages into log file +function printWarning(){ + currentTime=$(date) + echo "$currentTime Warning: $1" >> $LOG_FILE + return 0 +} + +# Logs error messages into log file +function printError(){ + currentTime=$(date) + echo "$currentTime ERROR: $1" >> $LOG_FILE + return 0 +} + +# Verifies the setup for the update process +function verifySetup(){ + if [ "$APP_DIR" == "$EMPTY_STRING" ] + then + printError "Brackets app dir is missing" + return $OPTIONS_MISSING + fi + + if [ "$APP_NAME" == "$EMPTY_STRING" ] + then + printError "Brackets app is missing" + return $OPTIONS_MISSING + fi + + if [ "$LOG_FILE" == "$EMPTY_STRING" ] + then + printError "Installer log file is missing" + return $OPTIONS_MISSING + fi + + if [ "$MOUNT_POINT" == "$EMPTY_STRING" ] + then + printError "DMG mount point is missing" + return $OPTIONS_MISSING + fi + + if [ "$TEMP_DIR" == "$EMPTY_STRING" ] + then + printError "Temp directory is missing" + return $OPTIONS_MISSING + fi + + if [ "$PID" == "$EMPTY_STRING" ] + then + printError "PID of current Brackets is missing" + return $OPTIONS_MISSING + fi + + return $SUCCESS +} + +# Updates the brackets app +function updateBrackets(){ + + printInfo "Check and wait if Brackets is still running ..." + + lsof -p $PID +r 1 &>/dev/null + exitStatus=$? + + # If Brackets is not running anymore : lsof returns 1 if process is not running, and 0 if it exited successfully while being waited + if [ $exitStatus -eq 1 ] || [ $exitStatus -eq 0 ] + then + printInfo "Brackets not running anymore." + + local abortInstallation=0 + + + if [ -d $APP_DIR ] + then + rm -rf "$TEMP_DIR/$APP_NAME" + printInfo "Moving the existing Brackets.app to temp dir updateTemp..." + mv "$APP_DIR/$APP_NAME" "$TEMP_DIR/$APP_NAME" + + exitStatus=$? + if [ $exitStatus -ne 0 ] + then + printError "Unable to move the existing Brackets app to temp directory updateTemp. mv retured $exitStatus" + abortInstallation=1 + else + printInfo "Move Successful" + + fi + fi + + if [ $abortInstallation -eq 0 ] + then + printInfo "Copying new Brackets.app ..." + + cp -r "$MOUNT_POINT/Brackets.app" "$APP_DIR/$APP_NAME" + exitStatus=$? + if [ $exitStatus -ne 0 ] + then + printError "Unable to copy Brackets.app. cp retured $exitStatus" + abortInstallation=1 + else + printInfo "Brackets.app is copied." + + printInfo "Verifying code signature of the new app." + codesign -vvvv "$APP_DIR/$APP_NAME" > /dev/null 2>&1 + exitStatus=$? + + if [ $exitStatus -ne 0 ] + then + printError "Unable to verify the downloaded $APP_DIR/$APP_NAME. codesign retured $exitStatus" + abortInstallation=1 + + printInfo "Deleting the new app copied." + rm -f $APP_DIR/$APP_NAME + exitStatus=$? + if [ $exitStatus -ne 0 ] + then + printError "Unable to delete $APP_DIR/$APP_NAME. rm retured $exitStatus" + else + printInfo "Moving the old brackets back from AppData" + mv "$TEMP_DIR/$APP_NAME" "$APP_DIR/$APP_NAME" + exitStatus=$? + if [ $exitStatus -ne 0 ] + then + printError "Unable to move the old brackets back from AppData. mv retured $exitStatus" + fi + fi + else + + printInfo "Code signature verified successfully." + printInfo "Marking Brackets as a trusted application..." + xattr -d -r com.apple.quarantine "$APP_DIR/$APP_NAME" + exitStatus=$? + if [ $exitStatus -ne 0 ] + then + printWarning "Unable to mark Brackets.app as trusted application. You may have to do it manually. xattr returnd $exitStatus." + else + printInfo "Brackets.app is marked as trusted application." + + fi + fi + fi + fi + + printInfo "Unmounting the DMG ..." + hdiutil detach "$MOUNT_POINT" "-force" + exitStatus=$? + if [ $exitStatus -ne 0 ] + then + printWarning "DMG could not be unmounted. hdiutil returnd $exitStatus." + else + printInfo "Unmounted the DMG and attempying to open Brackets ..." + fi + + open -a "$APP_DIR/$APP_NAME" + exitStatus=$? + if [ $exitStatus -ne 0 ] + then + printError "Brackets could not be opened. open returnd $exitStatus." + else + printInfo "Opened Brackets." + fi + + else + printError "Brackets could not be exited properly. lsof returned $exitStatus" + fi + +} + +# Parse the command line arguments +# -a - App name for currently installed Brackets +# -b - Absolute path to the currently installed Brackets App Directory +# -l - Absolute path to the updation log file path +# -m - Mount Point for the mounted disk image for latest Brackets version +# -t - Absolute path to the update temp directory in AppData +# -p - PID of the currently running brackets process + +while getopts a:b:l:m:t:p: OPT; do + case "$OPT" in + a) + if [ "$APP_NAME" == "$EMPTY_STRING" ] + then + APP_NAME=$OPTARG + fi + ;; + b) + if [ "$APP_DIR" == "$EMPTY_STRING" ] + then + APP_DIR=$OPTARG + fi + ;; + l) + if [ "$LOG_FILE" == "$EMPTY_STRING" ] + then + LOG_FILE=$OPTARG + fi + ;; + m) + if [ "$MOUNT_POINT" == "$EMPTY_STRING" ] + then + MOUNT_POINT=$OPTARG + fi + ;; + t) + if [ "$TEMP_DIR" == "$EMPTY_STRING" ] + then + TEMP_DIR=$OPTARG + fi + ;; + p) + if [ "$PID" == "$EMPTY_STRING" ] + then + PID=$OPTARG + fi + ;; + + esac + +done + + +# Log file for update process +echo "" > $LOG_FILE + +# Verify if the update setup is correctly initialized +verifySetup +result=$? +if [ $result -ne $SUCCESS ] +then + printError "Invalid setup" + exit $result +fi + +# Update brackets +updateBrackets diff --git a/installer/win/Brackets.wxs b/installer/win/Brackets.wxs index baf637419..d7558bfbf 100644 --- a/installer/win/Brackets.wxs +++ b/installer/win/Brackets.wxs @@ -77,7 +77,7 @@ - + ADDCONTEXTMENU="1" OR CONTEXTMENUREGISTRY @@ -114,18 +114,70 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + 1 - + --> @@ -137,6 +189,7 @@ + UPDATEPATH="1" - + + LAUNCH_APPLICATION_SILENT = 1 + LAUNCH_APPLICATION_SILENT = 1 + LAUNCH_APPLICATION_SILENT = 1 + LAUNCH_APPLICATION_SILENT = 1 + LAUNCH_APPLICATION_SILENT = 1 + diff --git a/installer/win/BracketsConfigurator/BracketsConfigurator/BracketsConfigurator.cs b/installer/win/BracketsConfigurator/BracketsConfigurator/BracketsConfigurator.cs new file mode 100644 index 000000000..aeb25e7b7 --- /dev/null +++ b/installer/win/BracketsConfigurator/BracketsConfigurator/BracketsConfigurator.cs @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2018 - present Adobe Systems Incorporated. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +using System; +using System.Collections.Generic; +using System.Text; +using System.Linq; +using Microsoft.Deployment.WindowsInstaller; + +namespace BracketsConfigurator +{ + public class BracketsConfiguratorClass + { + [CustomAction] + public static ActionResult BracketsConfigurator(Session session) + { + session.Log("Begin BracketsConfigurator"); + + //Set Install Directory if available + string installRegistry = session["INSTALLDIRREGISTRY"]; + string installDirValue = ""; + if (!string.IsNullOrEmpty(installRegistry)) + { + session.Log("Install Registry Value: " + installRegistry); + string[] path = installRegistry.Split('\\'); + //Remove executable name + path = path.Take(path.Count() - 1).ToArray(); + //Get path without executable + installDirValue = string.Join("\\", path) + "\\"; + session["INSTALLDIR"] = installDirValue; + session.Log("Updating Install Dir To: " + installDirValue); + } + else + { + session.Log("No Registry Value for installation directory"); + } + + //Set AddContextMenu if required + string contextMenuRegistry = session["CONTEXTMENUREGISTRY"]; + if (!string.IsNullOrEmpty(contextMenuRegistry)) + { + session.Log("Context Menu Registry Value: " + contextMenuRegistry); + session["ADDCONTEXTMENU"] = "1"; + session.Log("Setting Context Menu Option"); + } + else + { + session["ADDCONTEXTMENU"] = "0"; + session.Log("Not Adding to Context Menu"); + } + + //Set UpdatePath if required + string currentPathValue = session["CURRENTPATH"]; + session.Log("Current Path Value: " + currentPathValue); + if (!string.IsNullOrEmpty(currentPathValue) && currentPathValue.Contains(installDirValue)) + { + session["UPDATEPATH"] = "1"; + session.Log("Updating Path for Brackets"); + } + else + { + session["UPDATEPATH"] = "0"; + session.Log("Not Updating Path"); + } + + session.Log("End BracketsConfigurator"); + return ActionResult.Success; + } + } +} diff --git a/installer/win/BracketsConfigurator/BracketsConfigurator/BracketsConfigurator.csproj b/installer/win/BracketsConfigurator/BracketsConfigurator/BracketsConfigurator.csproj new file mode 100644 index 000000000..73f272e53 --- /dev/null +++ b/installer/win/BracketsConfigurator/BracketsConfigurator/BracketsConfigurator.csproj @@ -0,0 +1,53 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {CECF9330-C626-4D7F-87DA-5387E97881B2} + Library + Properties + BracketsConfigurator + BracketsConfigurator + v4.5.2 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/installer/win/BracketsConfigurator/BracketsConfigurator/CustomAction.config b/installer/win/BracketsConfigurator/BracketsConfigurator/CustomAction.config new file mode 100644 index 000000000..472d2dda5 --- /dev/null +++ b/installer/win/BracketsConfigurator/BracketsConfigurator/CustomAction.config @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + diff --git a/installer/win/BracketsConfigurator/BracketsConfigurator/Properties/AssemblyInfo.cs b/installer/win/BracketsConfigurator/BracketsConfigurator/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..5e1a3e721 --- /dev/null +++ b/installer/win/BracketsConfigurator/BracketsConfigurator/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("BracketsConfigurator")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("BracketsConfigurator")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("cecf9330-c626-4d7f-87da-5387e97881b2")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/installer/win/BracketsConfigurator/BracketsConfiguratorSolution.sln b/installer/win/BracketsConfigurator/BracketsConfiguratorSolution.sln new file mode 100644 index 000000000..40dfec9ef --- /dev/null +++ b/installer/win/BracketsConfigurator/BracketsConfiguratorSolution.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BracketsConfigurator", "BracketsConfigurator\BracketsConfigurator.csproj", "{CECF9330-C626-4D7F-87DA-5387E97881B2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CECF9330-C626-4D7F-87DA-5387E97881B2}.Debug|x86.ActiveCfg = Debug|x86 + {CECF9330-C626-4D7F-87DA-5387E97881B2}.Debug|x86.Build.0 = Debug|x86 + {CECF9330-C626-4D7F-87DA-5387E97881B2}.Release|x86.ActiveCfg = Release|x86 + {CECF9330-C626-4D7F-87DA-5387E97881B2}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/installer/win/LaunchBrackets/LaunchBrackets/CustomAction.config b/installer/win/LaunchBrackets/LaunchBrackets/CustomAction.config new file mode 100644 index 000000000..472d2dda5 --- /dev/null +++ b/installer/win/LaunchBrackets/LaunchBrackets/CustomAction.config @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + diff --git a/installer/win/LaunchBrackets/LaunchBrackets/LaunchBrackets.cs b/installer/win/LaunchBrackets/LaunchBrackets/LaunchBrackets.cs new file mode 100644 index 000000000..e719155eb --- /dev/null +++ b/installer/win/LaunchBrackets/LaunchBrackets/LaunchBrackets.cs @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2018 - present Adobe Systems Incorporated. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +using System; +using System.Collections.Generic; +using System.Text; +using Microsoft.Deployment.WindowsInstaller; +using System.IO; + +namespace LaunchBrackets +{ + public class LaunchBracketsClass + { + [CustomAction] + public static ActionResult LaunchBrackets(Session session) + { + session.Log("Begin LaunchBrackets"); + string bracketsInstallLocation = session["INSTALLDIRREGISTRY"]; + if (!string.IsNullOrEmpty(bracketsInstallLocation)) + { + session.Log("Received Brackets Install Location: " + bracketsInstallLocation); + if (File.Exists(bracketsInstallLocation)) + { + session.Log("Running brackets"); + System.Diagnostics.Process.Start(bracketsInstallLocation); + } + } + session.Log("Begin LaunchBrackets"); + + return ActionResult.Success; + } + } +} diff --git a/installer/win/LaunchBrackets/LaunchBrackets/LaunchBrackets.csproj b/installer/win/LaunchBrackets/LaunchBrackets/LaunchBrackets.csproj new file mode 100644 index 000000000..d764396b5 --- /dev/null +++ b/installer/win/LaunchBrackets/LaunchBrackets/LaunchBrackets.csproj @@ -0,0 +1,53 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {4922460C-3623-4C0D-900B-3E69E8F1EE98} + Library + Properties + LaunchBrackets + LaunchBrackets + v4.5.2 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/installer/win/LaunchBrackets/LaunchBrackets/Properties/AssemblyInfo.cs b/installer/win/LaunchBrackets/LaunchBrackets/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..effac1ce9 --- /dev/null +++ b/installer/win/LaunchBrackets/LaunchBrackets/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("LaunchBrackets")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("LaunchBrackets")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("4922460c-3623-4c0d-900b-3e69e8f1ee98")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/installer/win/LaunchBrackets/LaunchBracketsSolution.sln b/installer/win/LaunchBrackets/LaunchBracketsSolution.sln new file mode 100644 index 000000000..f791b7e65 --- /dev/null +++ b/installer/win/LaunchBrackets/LaunchBracketsSolution.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaunchBrackets", "LaunchBrackets\LaunchBrackets.csproj", "{4922460C-3623-4C0D-900B-3E69E8F1EE98}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4922460C-3623-4C0D-900B-3E69E8F1EE98}.Debug|x86.ActiveCfg = Debug|x86 + {4922460C-3623-4C0D-900B-3E69E8F1EE98}.Debug|x86.Build.0 = Debug|x86 + {4922460C-3623-4C0D-900B-3E69E8F1EE98}.Release|x86.ActiveCfg = Release|x86 + {4922460C-3623-4C0D-900B-3E69E8F1EE98}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/scripts/brackets_installer_projects.bat b/scripts/brackets_installer_projects.bat new file mode 100644 index 000000000..9f3c77634 --- /dev/null +++ b/scripts/brackets_installer_projects.bat @@ -0,0 +1,39 @@ +:: Batch file that creates the custom DLLs required to build the windows installers +:: This file should *not* be called directly. It is called by the build.sh script. +@ECHO OFF + +IF DEFINED VS140COMNTOOLS GOTO VS2015 +IF DEFINED VS120COMNTOOLS GOTO VS2013 +IF DEFINED VS110COMNTOOLS GOTO VS2012 +IF DEFINED VS100COMNTOOLS GOTO VS2010 + +:VSNotInstalled +ECHO Visual Studio 2010, 2012, 2013 or 2015 must be installed. +GOTO Error + +:VS2015 +call "%VS140COMNTOOLS%/vsvars32.bat" +GOTO Build + +:VS2013 +call "%VS120COMNTOOLS%/vsvars32.bat" +GOTO Build + +:VS2012 +call "%VS110COMNTOOLS%/vsvars32.bat" +GOTO Build + +:VS2010 +call "%VS100COMNTOOLS%/vsvars32.bat" +GOTO Build + +:Build +msbuild.exe installer\win\LaunchBrackets\LaunchBracketsSolution.sln /nr:false /t:Clean /p:Platform=x86 /p:Configuration=Release +msbuild.exe installer\win\LaunchBrackets\LaunchBracketsSolution.sln /nr:false /t:Build /p:Platform=x86 /p:Configuration=Release + +msbuild.exe installer\win\BracketsConfigurator\BracketsConfiguratorSolution.sln /nr:false /t:Clean /p:Platform=x86 /p:Configuration=Release +msbuild.exe installer\win\BracketsConfigurator\BracketsConfiguratorSolution.sln /nr:false /t:Build /p:Platform=x86 /p:Configuration=Release +exit /b %ERRORLEVEL% + +:Error +exit /b 1 diff --git a/tasks/build.js b/tasks/build.js index d1ca204c4..bf5b05e35 100644 --- a/tasks/build.js +++ b/tasks/build.js @@ -85,7 +85,7 @@ module.exports = function (grunt) { grunt.registerTask("build-win", "Build windows shell", function () { var done = this.async(); - spawn("cmd.exe /c scripts\\build_projects.bat").then(function () { + spawn(["cmd.exe /c scripts\\build_projects.bat", "cmd.exe /c scripts\\brackets_installer_projects.bat"]).then(function () { done(); }, function (err) { grunt.log.error(err); @@ -154,6 +154,7 @@ module.exports = function (grunt) { // task: stage-win grunt.registerTask("stage-win", "Stage win executable files", function () { // stage platform-specific binaries, then package www files + grunt.task.run("copy:winInstallerDLLs"); grunt.task.run("copy:win"); }); From d5c923f32952b070ade82214d36441411742b18f Mon Sep 17 00:00:00 2001 From: Nitesh Kumar <38075523+niteskum@users.noreply.github.com> Date: Mon, 23 Apr 2018 10:16:58 +0530 Subject: [PATCH 21/32] AutoUpdate Feature Health Data Logging Changes (#639) * AutoUpdate Feature Health Data Logging Changes * AutoUpdate Health Data Logging Changes * Corrected the Unintenional Change --- appshell/update_mac.mm | 8 ++++---- appshell/update_win.cpp | 6 +++--- installer/mac/update.sh | 28 ++++++++++++++-------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/appshell/update_mac.mm b/appshell/update_mac.mm index 0091cd35c..608ffc757 100644 --- a/appshell/update_mac.mm +++ b/appshell/update_mac.mm @@ -129,15 +129,15 @@ + (void) RunAppUpdate{ if (filePresent) { NSString *logStr; if([hdiPath length] == 0 ) { - logStr = @"hdiutil command could not be found"; + logStr = @"ERROR: hdiutil command could not be found: BA_01"; [logStr writeToFile:installStatusFilePath atomically:YES encoding:NSUTF8StringEncoding error:nil]; } if([shPath length] == 0 ) { - logStr = @"sh command could not be found"; + logStr = @"ERROR: sh command could not be found: BA_02"; [logStr writeToFile:installStatusFilePath atomically:YES encoding:NSUTF8StringEncoding error:nil]; } if([nohupPath length] == 0 ) { - logStr = @"nohupPath command could not be found"; + logStr = @"ERROR: nohupPath command could not be found: BA_03"; [logStr writeToFile:installStatusFilePath atomically:YES encoding:NSUTF8StringEncoding error:nil]; } } @@ -165,7 +165,7 @@ + (void) RunAppUpdate{ if (![[NSFileManager defaultManager] fileExistsAtPath:scriptPath]) { BOOL filePresent = [self createFileItNotExists:installStatusFilePath]; if (filePresent) { - NSString *logStr = @"update script could not be found"; + NSString *logStr = @"ERROR: update script could not be found: BA_04"; [logStr writeToFile:installStatusFilePath atomically:YES encoding:NSUTF8StringEncoding error:nil]; } } diff --git a/appshell/update_win.cpp b/appshell/update_win.cpp index 75f1274fd..2c8f2d2a5 100644 --- a/appshell/update_win.cpp +++ b/appshell/update_win.cpp @@ -85,7 +85,7 @@ void UpdateHelper::RunAppUpdate() { fp = _wfopen(m_installStatusFilePath.c_str(), L"a+"); if (fp != NULL) { std::wstring errStr = std::to_wstring(err); - fwprintf(fp, L"Installer process could not be created successfully. Error : %s \n", errStr.c_str()); + fwprintf(fp, L"Installer process could not be created successfully. ERROR: %s : BA_05\n", errStr.c_str()); } } } @@ -98,7 +98,7 @@ void UpdateHelper::RunAppUpdate() { //Command line interpreter could not be fetched if (fp != NULL) { std::wstring comspecStr = std::to_wstring(comspecEnv); - fwprintf(fp, L"Command line interpreter could not be fetched from the current environment. Error : %s \n", comspecStr.c_str()); + fwprintf(fp, L"Command line interpreter could not be fetched from the current environment. ERROR: %s : BA_06\n", comspecStr.c_str()); } } else @@ -106,7 +106,7 @@ void UpdateHelper::RunAppUpdate() { //COMSPEC variable not found if (fp != NULL) { std::wstring nSizeStr = std::to_wstring(nSize); - fwprintf(fp, L"COMSPEC not found in the current environment. Error : %s \n", nSizeStr.c_str()); + fwprintf(fp, L"COMSPEC not found in the current environment. ERROR: %s : BA_07\n", nSizeStr.c_str()); } } } diff --git a/installer/mac/update.sh b/installer/mac/update.sh index 62d4da655..12228aae3 100755 --- a/installer/mac/update.sh +++ b/installer/mac/update.sh @@ -38,37 +38,37 @@ function printError(){ function verifySetup(){ if [ "$APP_DIR" == "$EMPTY_STRING" ] then - printError "Brackets app dir is missing" + printError "Brackets app dir is missing: INS_O1" return $OPTIONS_MISSING fi if [ "$APP_NAME" == "$EMPTY_STRING" ] then - printError "Brackets app is missing" + printError "Brackets app is missing: INS_02" return $OPTIONS_MISSING fi if [ "$LOG_FILE" == "$EMPTY_STRING" ] then - printError "Installer log file is missing" + printError "Installer log file is missing: INS_03" return $OPTIONS_MISSING fi if [ "$MOUNT_POINT" == "$EMPTY_STRING" ] then - printError "DMG mount point is missing" + printError "DMG mount point is missing: INS_04" return $OPTIONS_MISSING fi if [ "$TEMP_DIR" == "$EMPTY_STRING" ] then - printError "Temp directory is missing" + printError "Temp directory is missing: INS_05" return $OPTIONS_MISSING fi if [ "$PID" == "$EMPTY_STRING" ] then - printError "PID of current Brackets is missing" + printError "PID of current Brackets is missing: INS_06" return $OPTIONS_MISSING fi @@ -100,7 +100,7 @@ function updateBrackets(){ exitStatus=$? if [ $exitStatus -ne 0 ] then - printError "Unable to move the existing Brackets app to temp directory updateTemp. mv retured $exitStatus" + printError "Unable to move the existing Brackets app to temp directory updateTemp. mv retured $exitStatus : INS_07" abortInstallation=1 else printInfo "Move Successful" @@ -116,7 +116,7 @@ function updateBrackets(){ exitStatus=$? if [ $exitStatus -ne 0 ] then - printError "Unable to copy Brackets.app. cp retured $exitStatus" + printError "Unable to copy Brackets.app. cp retured $exitStatus : INS_08" abortInstallation=1 else printInfo "Brackets.app is copied." @@ -127,7 +127,7 @@ function updateBrackets(){ if [ $exitStatus -ne 0 ] then - printError "Unable to verify the downloaded $APP_DIR/$APP_NAME. codesign retured $exitStatus" + printError "Unable to verify the downloaded $APP_DIR/$APP_NAME. codesign retured $exitStatus : INS_09" abortInstallation=1 printInfo "Deleting the new app copied." @@ -135,14 +135,14 @@ function updateBrackets(){ exitStatus=$? if [ $exitStatus -ne 0 ] then - printError "Unable to delete $APP_DIR/$APP_NAME. rm retured $exitStatus" + printError "Unable to delete $APP_DIR/$APP_NAME. rm retured $exitStatus : INS_10" else printInfo "Moving the old brackets back from AppData" mv "$TEMP_DIR/$APP_NAME" "$APP_DIR/$APP_NAME" exitStatus=$? if [ $exitStatus -ne 0 ] then - printError "Unable to move the old brackets back from AppData. mv retured $exitStatus" + printError "Unable to move the old brackets back from AppData. mv retured $exitStatus : INS_11" fi fi else @@ -176,13 +176,13 @@ function updateBrackets(){ exitStatus=$? if [ $exitStatus -ne 0 ] then - printError "Brackets could not be opened. open returnd $exitStatus." + printError "Brackets could not be opened. open returnd $exitStatus : INS_12" else printInfo "Opened Brackets." fi else - printError "Brackets could not be exited properly. lsof returned $exitStatus" + printError "Brackets could not be exited properly. lsof returned $exitStatus : INS_13" fi } @@ -247,7 +247,7 @@ verifySetup result=$? if [ $result -ne $SUCCESS ] then - printError "Invalid setup" + printError "Invalid setup : INS_14" exit $result fi From e356988c123704699474030dc84b936fa0638d93 Mon Sep 17 00:00:00 2001 From: niteskum Date: Wed, 25 Apr 2018 15:55:58 +0530 Subject: [PATCH 22/32] Changed the Windows Installer Command from Verbose to Info Logging --- appshell/update_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appshell/update_win.cpp b/appshell/update_win.cpp index 2c8f2d2a5..b716db313 100644 --- a/appshell/update_win.cpp +++ b/appshell/update_win.cpp @@ -54,7 +54,7 @@ void UpdateHelper::RunAppUpdate() { std::wstring commandInput = L"msiexec /i " + m_InstallerPath + L" /qr"; //AUTOUPDATE_PRERELEASE if (!m_logFilePath.empty()) { - commandInput += L" /l*V " + m_logFilePath; + commandInput += L" /li " + m_logFilePath; } commandInput += L" LAUNCH_APPLICATION_SILENT=1 MSIFASTINSTALL=2"; From 5be890b5fa752440dc993e735590c094ec136b49 Mon Sep 17 00:00:00 2001 From: gavankar Date: Wed, 25 Apr 2018 16:39:04 +0530 Subject: [PATCH 23/32] Adding maint version to brackets win installer (#640) This will allow an prerelease installer to upgrade a release build easily. --- installer/win/brackets-win-install-build.xml | 5 +++-- tasks/set-release.js | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/installer/win/brackets-win-install-build.xml b/installer/win/brackets-win-install-build.xml index f1899ed02..1d9cdec2a 100644 --- a/installer/win/brackets-win-install-build.xml +++ b/installer/win/brackets-win-install-build.xml @@ -13,8 +13,9 @@ default="build.mul"> - - + + + diff --git a/tasks/set-release.js b/tasks/set-release.js index dac3eb361..1ed7153f7 100644 --- a/tasks/set-release.js +++ b/tasks/set-release.js @@ -76,6 +76,11 @@ module.exports = function (grunt) { //, '' ); + text = safeReplace( + text, + //, + '' + ); grunt.file.write(winInstallerBuildXmlPath, text); // 3. Open installer/mac/buildInstaller.sh and change `dmgName` From 3be9d481122f5fc377faf0853967166e987c8bc9 Mon Sep 17 00:00:00 2001 From: Bhavika Miglani Date: Fri, 27 Apr 2018 18:25:36 +0530 Subject: [PATCH 24/32] Installer related changes (#643) * Handle buildnumber and prerelease string * Adding optional set relaese during installer build, bug fixes --- installer/win/brackets-win-install-build.xml | 3 +- tasks/build.js | 32 +++++++++++++++++++- tasks/set-release.js | 15 +++++++-- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/installer/win/brackets-win-install-build.xml b/installer/win/brackets-win-install-build.xml index 1d9cdec2a..8a298ef88 100644 --- a/installer/win/brackets-win-install-build.xml +++ b/installer/win/brackets-win-install-build.xml @@ -14,7 +14,8 @@ default="build.mul"> - + + diff --git a/tasks/build.js b/tasks/build.js index bf5b05e35..272fd8137 100644 --- a/tasks/build.js +++ b/tasks/build.js @@ -40,10 +40,24 @@ module.exports = function (grunt) { return env; } + + function safeReplace(content, regexp, replacement) { + if (!regexp.test(content)) { + grunt.fail.fatal("Regexp " + regexp + " did not match"); + } + + var newContent = content.replace(regexp, replacement); + + if (newContent === content) { + grunt.log.warn("Buildnumber for ", regexp, "hasn't been updated, because it's already set."); + } + + return newContent; + } // task: full-build grunt.registerTask("full-build", ["git", "create-project", "build-www", "build", "stage", "package"]); - grunt.registerTask("installer", ["full-build", "build-installer"]); + grunt.registerTask("installer", ["set-release-optional", "full-build", "build-installer"]); // task: build grunt.registerTask("build", "Build shell executable. Run 'grunt full-build' to update repositories, build the shell and package www files.", function (wwwBranch, shellBranch) { @@ -191,6 +205,22 @@ module.exports = function (grunt) { grunt.registerTask("build-installer-win", "Build windows installer", function () { var done = this.async(); + var configData = grunt.file.readJSON(grunt.config("config-json")); + var packageData = grunt.file.readJSON("package.json"); + var buildnumber = configData.buildnumber; + var winInstallerBuildXmlPath = "installer/win/brackets-win-install-build.xml"; + var text = grunt.file.read(winInstallerBuildXmlPath); + text = safeReplace( + text, + //, + '' + ); + configData.prerelease = packageData.prerelease; + + grunt.file.write(winInstallerBuildXmlPath, text); + grunt.file.write(grunt.config("config-json"), JSON.stringify(configData, null, " ")); + + spawn(["cmd.exe /c ant.bat -f brackets-win-install-build.xml"], { cwd: resolve("installer/win"), env: getBracketsEnv() }).then(function () { done(); }, function (err) { diff --git a/tasks/set-release.js b/tasks/set-release.js index 1ed7153f7..1e2042eb5 100644 --- a/tasks/set-release.js +++ b/tasks/set-release.js @@ -40,9 +40,8 @@ module.exports = function (grunt) { return newContent; } - - // task: set-release - grunt.registerTask("set-release", "Update occurrences of release number for all native installers and binaries", function () { + + function setRelease() { var packageJsonPath = "package.json", packageJSON = grunt.file.readJSON(packageJsonPath), winInstallerBuildXmlPath = "installer/win/brackets-win-install-build.xml", @@ -62,6 +61,7 @@ module.exports = function (grunt) { // 1. Update package.json packageJSON.version = newVersion.version + "-0"; + packageJSON.prerelease = newVersion.prerelease.toString(); common.writeJSON(packageJsonPath, packageJSON); // 2. Open installer/win/brackets-win-install-build.xml and change `product.release.number` @@ -128,5 +128,14 @@ module.exports = function (grunt) { 'APP_VERSION "' + newVersion.major + "." + newVersion.minor + "." + newVersion.patch + "." + (newVersion.build.length ? newVersion.build : "0") + '"' ); grunt.file.write(linuxVersionFile, text); + } + + // task: set-release + grunt.registerTask("set-release", "Update occurrences of release number for all native installers and binaries", setRelease); + grunt.registerTask("set-release-optional", "Update occurrences of release number for all native installers and binaries", function () { + if (grunt.option("release")) { + setRelease(); + } }); + }; From afa6496f0738271d0581b72dbe91cc6f91ce9428 Mon Sep 17 00:00:00 2001 From: Boopesh Mahendran Date: Fri, 27 Apr 2018 18:26:42 +0530 Subject: [PATCH 25/32] Disable drag handlers if OS is linux (#642) --- appshell/browser/client_handler.cc | 2 ++ appshell/browser/client_handler.h | 5 +++++ appshell/client_handler.cpp | 2 ++ appshell/client_handler.h | 8 ++++++++ 4 files changed, 17 insertions(+) diff --git a/appshell/browser/client_handler.cc b/appshell/browser/client_handler.cc index ac8fc66f4..eb2f709a2 100644 --- a/appshell/browser/client_handler.cc +++ b/appshell/browser/client_handler.cc @@ -323,6 +323,7 @@ void ClientHandler::OnDownloadUpdated( } } +#ifndef OS_LINUX bool ClientHandler::OnDragEnter(CefRefPtr browser, CefRefPtr dragData, CefDragHandler::DragOperationsMask mask) { @@ -334,6 +335,7 @@ bool ClientHandler::OnDragEnter(CefRefPtr browser, return false; } +#endif void ClientHandler::OnDraggableRegionsChanged( CefRefPtr browser, diff --git a/appshell/browser/client_handler.h b/appshell/browser/client_handler.h index b3363a10a..6a13ddd9f 100644 --- a/appshell/browser/client_handler.h +++ b/appshell/browser/client_handler.h @@ -105,9 +105,12 @@ class ClientHandler : CefRefPtr GetDownloadHandler() OVERRIDE { return this; } + #ifndef OS_LINUX CefRefPtr GetDragHandler() OVERRIDE { return this; } + #endif + CefRefPtr GetGeolocationHandler() OVERRIDE { return this; } @@ -173,9 +176,11 @@ class ClientHandler : CefRefPtr callback) OVERRIDE; // CefDragHandler methods + #ifndef OS_LINUX bool OnDragEnter(CefRefPtr browser, CefRefPtr dragData, CefDragHandler::DragOperationsMask mask) OVERRIDE; + #endif void OnDraggableRegionsChanged( CefRefPtr browser, diff --git a/appshell/client_handler.cpp b/appshell/client_handler.cpp index 9add38a83..83d3d8f6f 100644 --- a/appshell/client_handler.cpp +++ b/appshell/client_handler.cpp @@ -188,6 +188,7 @@ void ClientHandler::OnBeforeClose(CefRefPtr browser) { std::vector gDroppedFiles; +#ifndef OS_LINUX bool ClientHandler::OnDragEnter(CefRefPtr browser, CefRefPtr dragData, DragOperationsMask mask) { @@ -200,6 +201,7 @@ bool ClientHandler::OnDragEnter(CefRefPtr browser, } return false; } +#endif void ClientHandler::OnLoadStart(CefRefPtr browser, CefRefPtr frame diff --git a/appshell/client_handler.h b/appshell/client_handler.h index b9a516c99..7c67a3598 100644 --- a/appshell/client_handler.h +++ b/appshell/client_handler.h @@ -24,7 +24,9 @@ // ClientHandler implementation. class ClientHandler : public CefClient, public CefLifeSpanHandler, + #ifndef OS_LINUX public CefDragHandler, + #endif public CefLoadHandler, public CefRequestHandler, public CefDisplayHandler, @@ -76,9 +78,13 @@ class ClientHandler : public CefClient, virtual CefRefPtr GetLifeSpanHandler() OVERRIDE { return this; } + + #ifndef OS_LINUX virtual CefRefPtr GetDragHandler() OVERRIDE { return this; } + #endif + virtual CefRefPtr GetLoadHandler() OVERRIDE { return this; } @@ -119,10 +125,12 @@ virtual bool OnBeforePopup(CefRefPtr browser, virtual void OnAfterCreated(CefRefPtr browser) OVERRIDE; virtual void OnBeforeClose(CefRefPtr browser) OVERRIDE; + #ifndef OS_LINUX // CefDragHandler methods virtual bool OnDragEnter(CefRefPtr browser, CefRefPtr dragData, DragOperationsMask mask) OVERRIDE; + #endif // CefLoadHandler methods virtual void OnLoadStart(CefRefPtr browser, From baf74c561eea95e4af007173b266d288fcc236c7 Mon Sep 17 00:00:00 2001 From: gavankar Date: Wed, 2 May 2018 23:51:03 +0530 Subject: [PATCH 26/32] Revert "Adding maint version to brackets win installer (#640)" (#644) This reverts commit 5be890b5fa752440dc993e735590c094ec136b49. This combined with addition of build number to the installer was causing bugs for windows upgrade scenarios --- installer/win/brackets-win-install-build.xml | 3 +-- tasks/set-release.js | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/installer/win/brackets-win-install-build.xml b/installer/win/brackets-win-install-build.xml index 8a298ef88..24a4f0320 100644 --- a/installer/win/brackets-win-install-build.xml +++ b/installer/win/brackets-win-install-build.xml @@ -13,9 +13,8 @@ default="build.mul"> - - + diff --git a/tasks/set-release.js b/tasks/set-release.js index 1e2042eb5..a197ddc10 100644 --- a/tasks/set-release.js +++ b/tasks/set-release.js @@ -76,11 +76,6 @@ module.exports = function (grunt) { //, '' ); - text = safeReplace( - text, - //, - '' - ); grunt.file.write(winInstallerBuildXmlPath, text); // 3. Open installer/mac/buildInstaller.sh and change `dmgName` From f09f01ac49ccf287c5fec07f532a899a65b11ea6 Mon Sep 17 00:00:00 2001 From: sobisht Date: Mon, 14 May 2018 17:00:59 +0530 Subject: [PATCH 27/32] Linux: Add a check if file exist when Show in OS is clicked --- appshell/appshell_extensions_gtk.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/appshell/appshell_extensions_gtk.cpp b/appshell/appshell_extensions_gtk.cpp index 77bf201fe..0872bb3c3 100644 --- a/appshell/appshell_extensions_gtk.cpp +++ b/appshell/appshell_extensions_gtk.cpp @@ -723,6 +723,12 @@ int ShowFolderInOSWindow(ExtensionString pathname) GError *gerror = NULL; gchar *uri = NULL, *parentdir = NULL; + // Check if file exist in OS + struct stat fileStat; + if (stat(pathname.c_str(), &fileStat) != 0) { + return ERR_NOT_FOUND; + } + if (g_file_test(pathname.c_str(), G_FILE_TEST_IS_DIR)) { uri = g_filename_to_uri(pathname.c_str(), NULL, NULL); if (!gtk_show_uri(NULL, uri, GDK_CURRENT_TIME, &gerror)) { From 77adbcbca69733e11bb4861ababe28b663e8f699 Mon Sep 17 00:00:00 2001 From: Gautam Jha Date: Mon, 14 May 2018 17:34:26 +0530 Subject: [PATCH 28/32] Disable GPU for Ubuntu18.04 (#648) * Disable GPU for Ubuntu18.04 * Incorporating suggetsed changes --- appshell/cefclient_gtk.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appshell/cefclient_gtk.cc b/appshell/cefclient_gtk.cc index e4304db01..bb45d6ce1 100644 --- a/appshell/cefclient_gtk.cc +++ b/appshell/cefclient_gtk.cc @@ -233,5 +233,7 @@ int RunMain(int argc, char* argv[]) { // Program entry point function. int main(int argc, char* argv[]) { + char extra_option[] ="--disable-gpu"; + argv[argc]=extra_option; ++argc; return client::RunMain(argc, argv); } From 7350d0b5fd1cf7f4ef156933ee17503644dae825 Mon Sep 17 00:00:00 2001 From: Gautam Jha Date: Mon, 14 May 2018 17:35:00 +0530 Subject: [PATCH 29/32] Build fixes for Ubuntu18.04 (#649) --- appshell/appshell_extensions_platform.cpp | 1 + appshell/appshell_extensions_platform.h | 3 +++ appshell/browser/client_handler.cc | 4 ++++ appshell/browser/client_handler.h | 4 ++++ 4 files changed, 12 insertions(+) diff --git a/appshell/appshell_extensions_platform.cpp b/appshell/appshell_extensions_platform.cpp index 943b003d4..2337552c7 100644 --- a/appshell/appshell_extensions_platform.cpp +++ b/appshell/appshell_extensions_platform.cpp @@ -7,6 +7,7 @@ #include "appshell/browser/main_context.h" #include "appshell/browser/root_window_manager.h" #include "appshell/browser/root_window_gtk.h" +#include #endif #define UTF8_BOM "\xEF\xBB\xBF" diff --git a/appshell/appshell_extensions_platform.h b/appshell/appshell_extensions_platform.h index 405628e0c..6ed8849ad 100644 --- a/appshell/appshell_extensions_platform.h +++ b/appshell/appshell_extensions_platform.h @@ -33,6 +33,9 @@ #ifdef OS_LINUX #include +#include +#include +#include #endif // Extension error codes. These MUST be in sync with the error diff --git a/appshell/browser/client_handler.cc b/appshell/browser/client_handler.cc index eb2f709a2..81d5e1830 100644 --- a/appshell/browser/client_handler.cc +++ b/appshell/browser/client_handler.cc @@ -337,6 +337,9 @@ bool ClientHandler::OnDragEnter(CefRefPtr browser, } #endif +#ifndef OS_LINUX +//We do not plan to add any feature to parent class(::ClientHandler) implementation of this function. +//So override is useless, modern compilers will complain about this. void ClientHandler::OnDraggableRegionsChanged( CefRefPtr browser, const std::vector& regions) { @@ -344,6 +347,7 @@ void ClientHandler::OnDraggableRegionsChanged( NotifyDraggableRegions(regions); } +#endif bool ClientHandler::OnRequestGeolocationPermission( CefRefPtr browser, diff --git a/appshell/browser/client_handler.h b/appshell/browser/client_handler.h index 6a13ddd9f..13e32e621 100644 --- a/appshell/browser/client_handler.h +++ b/appshell/browser/client_handler.h @@ -182,9 +182,13 @@ class ClientHandler : CefDragHandler::DragOperationsMask mask) OVERRIDE; #endif +#ifndef OS_LINUX +//We do not plan to add any feature to parent class(::ClientHandler) implementation of this function. +//So override is useless, modern compilers will complain about this. void OnDraggableRegionsChanged( CefRefPtr browser, const std::vector& regions) OVERRIDE; +#endif // CefGeolocationHandler methods bool OnRequestGeolocationPermission( From eb4b1127ad2b7b94341e6ab817c7a4eea2771fc9 Mon Sep 17 00:00:00 2001 From: sobisht Date: Tue, 15 May 2018 11:02:11 +0530 Subject: [PATCH 30/32] Fixing indentation --- appshell/appshell_extensions_gtk.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/appshell/appshell_extensions_gtk.cpp b/appshell/appshell_extensions_gtk.cpp index 0872bb3c3..2828dddb4 100644 --- a/appshell/appshell_extensions_gtk.cpp +++ b/appshell/appshell_extensions_gtk.cpp @@ -723,11 +723,11 @@ int ShowFolderInOSWindow(ExtensionString pathname) GError *gerror = NULL; gchar *uri = NULL, *parentdir = NULL; - // Check if file exist in OS - struct stat fileStat; - if (stat(pathname.c_str(), &fileStat) != 0) { - return ERR_NOT_FOUND; - } + // Check if file exist in OS + struct stat fileStat; + if (stat(pathname.c_str(), &fileStat) != 0) { + return ERR_NOT_FOUND; + } if (g_file_test(pathname.c_str(), G_FILE_TEST_IS_DIR)) { uri = g_filename_to_uri(pathname.c_str(), NULL, NULL); From 10e4715b21ad2c20fef3276cec2a4d0aebb7148e Mon Sep 17 00:00:00 2001 From: Boopesh Mahendran Date: Mon, 28 May 2018 14:55:50 +0530 Subject: [PATCH 31/32] Fix #14244 - Close file handle on unsupported encoding (#652) * Close file handle on unsupported encoding * Fix spacing --- appshell/appshell_extensions_win.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/appshell/appshell_extensions_win.cpp b/appshell/appshell_extensions_win.cpp index e5666fa7f..e91aa83cc 100644 --- a/appshell/appshell_extensions_win.cpp +++ b/appshell/appshell_extensions_win.cpp @@ -969,6 +969,7 @@ int32 ReadFile(ExtensionString filename, ExtensionString& encoding, std::string& detectedCharSet = conv.to_bytes(encoding); } if (detectedCharSet == "UTF-16LE" || detectedCharSet == "UTF-16BE") { + CloseHandle(hFile); return ERR_UNSUPPORTED_UTF16_ENCODING; } std::transform(detectedCharSet.begin(), detectedCharSet.end(), detectedCharSet.begin(), ::toupper); From 1f398cca5009c01123a5f9a509fcac9a252f9093 Mon Sep 17 00:00:00 2001 From: sabanaya <39121066+sabanaya@users.noreply.github.com> Date: Mon, 28 May 2018 16:03:39 +0530 Subject: [PATCH 32/32] Fix Issue 14149 - Fixes Dns rebinding attack in CEF (#651) * Update cef_version for windows only * Mac CEF distribution with DNS Rebinding attack fix * Upgrade CEF to 2704 on mac with DNS rebinding fix * Fix compilation issues on mac after upgrading CEF * Linux changes for DNS issue * Cef version update --- Gruntfile.js | 10 ++++++---- appshell/cefclient_mac.mm | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 2603d6977..58beee565 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -27,7 +27,7 @@ module.exports = function (grunt) { var common = require("./tasks/common")(grunt), platform = common.platform(), staging, - cef_version = "3.2623.1397"; + cef_version = "3.2623.1402"; if (platform === "mac") { staging = "installer/mac/staging/<%= build.name %>.app/Contents"; @@ -37,8 +37,10 @@ module.exports = function (grunt) { staging = "installer/linux/debian/package-root/opt/brackets"; } - if (platform === "linux") { - cef_version = "3.2785.1486"; + if (platform === "mac") { + cef_version = "3.2704.1434"; + } else if (platform === "linux") { + cef_version = "3.2785.1487"; } grunt.initConfig({ @@ -346,4 +348,4 @@ module.exports = function (grunt) { grunt.loadNpmTasks("grunt-curl"); grunt.registerTask("default", ["setup", "build"]); -}; \ No newline at end of file +}; diff --git a/appshell/cefclient_mac.mm b/appshell/cefclient_mac.mm index d588bbd30..09eb5e61a 100644 --- a/appshell/cefclient_mac.mm +++ b/appshell/cefclient_mac.mm @@ -13,7 +13,6 @@ #import "include/cef_application_mac.h" #include "include/cef_browser.h" #include "include/cef_frame.h" -#include "include/cef_runnable.h" #include "client_handler.h" #include "appshell/browser/resource_util.h" #include "config.h"