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

Commit

Permalink
Ability to choose output for xcode images
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoCartier committed Aug 24, 2016
1 parent d315c24 commit 8721e02
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ var _ = require('underscore');
var Q = require('q');
var argv = require('minimist')(process.argv.slice(2));

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

/**
* Check which platforms are added to the project and return their icon names and sizes
*
Expand All @@ -16,11 +24,17 @@ var argv = require('minimist')(process.argv.slice(2));
var getPlatforms = function (projectName) {
var deferred = Q.defer();
var platforms = [];
var xcodeFolder = '/Images.xcassets/AppIcon.appiconset/';

if (settings.OLD_XCODE_PATH) {
xcodeFolder = '/Resources/icons/';
}

platforms.push({
name : 'ios',
// TODO: use async fs.exists
isAdded : fs.existsSync('platforms/ios'),
iconsPath : 'platforms/ios/' + projectName + '/Resources/icons/',
iconsPath : 'platforms/ios/' + projectName + xcodeFolder,
icons : [
{ name : 'icon-40.png', size : 40 },
{ name : '[email protected]', size : 80 },
Expand Down Expand Up @@ -59,7 +73,7 @@ var getPlatforms = function (projectName) {
name : 'osx',
// TODO: use async fs.exists
isAdded : fs.existsSync('platforms/osx'),
iconsPath : 'platforms/osx/' + projectName + '/Images.xcassets/AppIcon.appiconset/',
iconsPath : 'platforms/osx/' + projectName + xcodeFolder,
icons : [
{ name : 'icon-16x16.png', size : 16 },
{ name : 'icon-32x32.png', size : 32 },
Expand Down Expand Up @@ -116,14 +130,6 @@ var getPlatforms = function (projectName) {
return deferred.promise;
};


/**
* @var {Object} settings - names of the config file and of the icon image
*/
var settings = {};
settings.CONFIG_FILE = argv.config || 'config.xml';
settings.ICON_FILE = argv.icon || 'icon.png';

/**
* @var {Object} console utils
*/
Expand Down

0 comments on commit 8721e02

Please sign in to comment.