diff --git a/index.html b/index.html
index 015df9cd..e273b41e 100644
--- a/index.html
+++ b/index.html
@@ -459,8 +459,28 @@
Keep in Touch
});
$.when(ajaxRequest, i18nLoaded).done(function (data) {
- var build = data[0][0],
- buildName = build.versionString;
+ var allBuilds = data[0],
+ build = data[0][0]; // default initialization with latest build
+
+ // Find the applicable build for current platform
+ // If current platform is unsupported (OTHERS), then take the last common release
+ // If a build entry doesn't have 'platforms' key -> Older format for all supported OS
+ for (var buildIndex = 0; buildIndex < allBuilds.length; buildIndex++) {
+ build = allBuilds[buildIndex];
+ if (!build.platforms) { // Older format detected - Applicable to all platforms
+ break;
+ } else {
+ if (build.platforms[OS]) { // Current platform is one of the supported platforms
+ break;
+ } else if (OS == "OTHER") { // Unsupported platform detected
+ if (Object.keys(build.platforms).length == 4) { // Build applicable for all platforms
+ break;
+ }
+ }
+ }
+ }
+
+ var buildName = build.versionString;
if (buildName) {
var buildNum = buildName.match(/([\d.]+)/);
@@ -470,11 +490,16 @@ Keep in Touch
// update button
if (OS !== "OTHER" && buildNum) {
- var tag = buildName.toLowerCase().split(" ").join("-"),
+ var url;
+ if (build.platforms && build.platforms[OS]) { // Fetch download url from platform entry
+ url = build.platforms[OS].downloadURL;
+ } else { // Generate the download URI
+ var tag = buildName.toLowerCase().split(" ").join("-");
url = "https://github.com/adobe/brackets/releases/" + tag;
- if (ext) {
- url = "https://github.com/adobe/brackets/releases/download/" + tag + "/Brackets." + buildName.split(" ").join(".") + ext;
+ if (ext) {
+ url = "https://github.com/adobe/brackets/releases/download/" + tag + "/Brackets." + buildName.split(" ").join(".") + ext;
+ }
}
$("#download-brackets-version").text(buildNum);