Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions projectGeneratorElectron/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down Expand Up @@ -289,6 +300,11 @@ function parseAddonsAndUpdateSelect(arg) {
console.log("in parseAddonsAndUpdateSelect " + arg);
//path = require('path').resolve(__dirname, defaultOfPath + "/addons");
addons = getDirectories(arg + "/addons","ofx");

addons = addons.filter( function(addon) {
return addonsToSkip.indexOf(addon)==-1;
});

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should work but in javascript you have this nice functional operators for collections where you can do something like:

addons = addons.filter( function(addon) {
    return !addonsToSkip.contains(addon);
});

which means: for addons, keep only those which are not contained in addonsToSkip

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool -- but I get "addonsToSkip.contains is not a function" error....

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, might be a later addition, i think includes instead of contains should work and this should work for sure:

addons = addons.filter( function(addon) {
    return addonsToSkip.indexOf(addon)==-1;
});

console.log("Reloading the addons folder, these were found:");
console.log(addons);
mainWindow.webContents.send('setAddons', addons);
Expand Down