From 47a46ae9ff7515f3cbdde08af20013eb8120aa3f Mon Sep 17 00:00:00 2001 From: Slava Kim Date: Wed, 1 Oct 2014 10:51:12 -0700 Subject: [PATCH] Parse files extensions other than png --- tools/commands-cordova.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/commands-cordova.js b/tools/commands-cordova.js index f94c3f36c8..3ccbcd514f 100644 --- a/tools/commands-cordova.js +++ b/tools/commands-cordova.js @@ -1269,18 +1269,20 @@ var consumeControlFile = function (controlFilePath, cordovaPath) { files.mkdir_p(resourcesPath); verboseLog('Copying resources for mobile apps'); - // XXX makes a big assumption that every file is a png var setImages = function (sizes, xmlEle, tag) { _.each(sizes, function (size, name) { var width = size.split('x')[0]; var height = size.split('x')[1]; - if (! _.has(imagePaths[tag], name)) + var suppliedPath = imagePaths[tag][name]; + if (! suppliedPath) return; - var fileName = name + '.' + tag + '.png'; + var extension = _.last(_.last(suppliedPath.split(path.sep)).split('.')); + var fileName = name + '.' + tag + '.' + extension; + // copy the file to the build folder with a standardized name - files.copyFile(path.join(project.rootDir, imagePaths[tag][name]), + files.copyFile(path.join(project.rootDir, suppliedPath), path.join(resourcesPath, fileName)); // set it to the xml tree