This repository has been archived by the owner on Oct 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from gregvis/master
added android version detection to automatically adjust output folder
- Loading branch information
Showing
3 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 | ||
* | ||
|
@@ -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 }, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters