From 8721e02aae3249972d542085680c35e2fd44cbaf Mon Sep 17 00:00:00 2001 From: Bruno C Date: Wed, 24 Aug 2016 20:30:21 +0200 Subject: [PATCH] Ability to choose output for xcode images --- index.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 3d5a200..8b90502 100644 --- a/index.js +++ b/index.js @@ -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 * @@ -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 : 'icon-40@2x.png', size : 80 }, @@ -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 }, @@ -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 */