From 5da31bd18f00d153e5013ec387787b1ecdefbd6d Mon Sep 17 00:00:00 2001 From: zach lieberman Date: Wed, 28 Oct 2015 02:34:04 -0400 Subject: [PATCH 1/2] skipping some addons --- projectGeneratorElectron/index.js | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/projectGeneratorElectron/index.js b/projectGeneratorElectron/index.js index a23b7aec..f6fde894 100644 --- a/projectGeneratorElectron/index.js +++ b/projectGeneratorElectron/index.js @@ -77,6 +77,17 @@ console.log("detected platform: " + hostplatform + " in " + __dirname); var defaultOfPath = obj["defaultOfPath"]; var addons; + +// hide some addons, per https://github.com/openframeworks/projectGenerator/issues/62 + +var addonsToSkip = [ + "ofxiOS", + "ofxMultiTouch", + "ofxEmscripten", + "ofxAccelerometer", + "ofxAndroid" +] + var platforms = { "osx": "OS X (Xcode)", "vs": "Windows (Visual Studio 2015)", @@ -289,6 +300,27 @@ function parseAddonsAndUpdateSelect(arg) { console.log("in parseAddonsAndUpdateSelect " + arg); //path = require('path').resolve(__dirname, defaultOfPath + "/addons"); addons = getDirectories(arg + "/addons","ofx"); + + var a = addons; + var b = addonsToSkip; + var addonsThatShouldBeShown = []; + var found; + for (var i = 0; i < a.length; i++) { + found = false; + // find a[i] in b + for (var j = 0; j < b.length; j++) { + if (a[i] == b[j]) { + found = true; + break; + } + } + if (!found) { + addonsThatShouldBeShown.push(a[i]); + } + } + + addons = addonsThatShouldBeShown; + console.log("Reloading the addons folder, these were found:"); console.log(addons); mainWindow.webContents.send('setAddons', addons); From 40506ed3788494c0233e066d87d5c8bc359deb90 Mon Sep 17 00:00:00 2001 From: zach lieberman Date: Wed, 28 Oct 2015 04:31:42 -0400 Subject: [PATCH 2/2] smarter filtering --- projectGeneratorElectron/index.js | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/projectGeneratorElectron/index.js b/projectGeneratorElectron/index.js index f6fde894..c66528e3 100644 --- a/projectGeneratorElectron/index.js +++ b/projectGeneratorElectron/index.js @@ -301,25 +301,9 @@ function parseAddonsAndUpdateSelect(arg) { //path = require('path').resolve(__dirname, defaultOfPath + "/addons"); addons = getDirectories(arg + "/addons","ofx"); - var a = addons; - var b = addonsToSkip; - var addonsThatShouldBeShown = []; - var found; - for (var i = 0; i < a.length; i++) { - found = false; - // find a[i] in b - for (var j = 0; j < b.length; j++) { - if (a[i] == b[j]) { - found = true; - break; - } - } - if (!found) { - addonsThatShouldBeShown.push(a[i]); - } - } - - addons = addonsThatShouldBeShown; + addons = addons.filter( function(addon) { + return addonsToSkip.indexOf(addon)==-1; + }); console.log("Reloading the addons folder, these were found:"); console.log(addons);