Skip to content
This repository has been archived by the owner on Oct 19, 2020. It is now read-only.

Commit

Permalink
Merge pull request #114 from gregvis/master
Browse files Browse the repository at this point in the history
added android version detection to automatically adjust output folder
  • Loading branch information
AlexDisler authored Feb 6, 2018
2 parents 612490e + 3bbc773 commit 87ddfc6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ build/Release
# Deployed apps should consider commenting this line out:
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
node_modules
yarn.lock
19 changes: 18 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var colors = require('colors');
var _ = require('underscore');
var Q = require('q');
var argv = require('minimist')(process.argv.slice(2));
var semver = require('semver');

/**
* @var {Object} settings - names of the config file and of the icon image
Expand All @@ -15,6 +16,22 @@ settings.CONFIG_FILE = argv.config || 'config.xml';
settings.ICON_FILE = argv.icon || 'icon.png';
settings.OLD_XCODE_PATH = argv['xcode-old'] || false;


/**
* Get Android Folder based on Android Platform version
*/
var getAndroidFolder = function(){
var androidFolder = 'platforms/android/app/src/main/res/'; //as of [email protected]
if(!fs.existsSync('platforms/android/cordova/version')){
return androidFolder;
}
if(semver.lt(require('../../platforms/android/cordova/version').version, '7.0.0')){
androidFolder = 'platforms/android/res/';
}
return androidFolder;
}


/**
* Check which platforms are added to the project and return their icon names and sizes
*
Expand Down Expand Up @@ -69,7 +86,7 @@ var getPlatforms = function (projectName) {
platforms.push({
name : 'android',
isAdded : fs.existsSync('platforms/android'),
iconsPath : 'platforms/android/res/',
iconsPath : getAndroidFolder(),
icons : [
{ name : 'drawable/icon.png', size : 96 },
{ name : 'drawable-hdpi/icon.png', size : 72 },
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"imagemagick": "^0.1.3",
"minimist": "^1.2.0",
"q": "^1.0.1",
"semver": "^5.5.0",
"underscore": "^1.6.0",
"xml2js": "^0.4.3"
}
Expand Down

0 comments on commit 87ddfc6

Please sign in to comment.