You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by br...@apache.org on 2018/12/11 21:13:54 UTC
[cordova-node-xcode] branch master updated: Resolve issue with
pbxFile extension (#31)
This is an automated email from the ASF dual-hosted git repository.
brodybits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-node-xcode.git
The following commit(s) were added to refs/heads/master by this push:
new b732ae5 Resolve issue with pbxFile extension (#31)
b732ae5 is described below
commit b732ae53130d1049ba1d1cb1b8ce11498e8d8232
Author: Chris Brody <ch...@gmail.com>
AuthorDate: Tue Dec 11 16:13:50 2018 -0500
Resolve issue with pbxFile extension (#31)
where pbxFile extension was being set to 'undefined'
and add new test case to verify the bug fix
with a quick test fix by @brodybits (Christopher J. Brody)
for the sake of consistency with the other test cases
NOTE: These changes were originally part of
apache/cordova-node-xcode#12 (cordova-node-xcode PR #12),
extracted here by @brodybits.
Co-authored-by: Kyle Spearrin <ks...@users.noreply.github.com>
Co-authored-by: Christopher J. Brody <br...@litehelpers.net>
---
lib/pbxFile.js | 7 ++++---
test/pbxFile.js | 8 ++++++++
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/lib/pbxFile.js b/lib/pbxFile.js
index 4d593f0..9553bfb 100644
--- a/lib/pbxFile.js
+++ b/lib/pbxFile.js
@@ -83,7 +83,7 @@ var FILETYPE_BY_EXTENSION = {
function unquoted(text){
- return text.replace (/(^")|("$)/g, '')
+ return text == null ? '' : text.replace (/(^")|("$)/g, '')
}
function detectType(filePath) {
@@ -98,11 +98,12 @@ function detectType(filePath) {
}
function defaultExtension(fileRef) {
- var filetype = fileRef.lastKnownFileType || fileRef.explicitFileType;
+ var filetype = fileRef.lastKnownFileType && fileRef.lastKnownFileType != DEFAULT_FILETYPE ?
+ fileRef.lastKnownFileType : fileRef.explicitFileType;
for(var extension in FILETYPE_BY_EXTENSION) {
if(FILETYPE_BY_EXTENSION.hasOwnProperty(unquoted(extension)) ) {
- if(FILETYPE_BY_EXTENSION[unquoted(extension)] === filetype )
+ if(FILETYPE_BY_EXTENSION[unquoted(extension)] === unquoted(filetype) )
return extension;
}
}
diff --git a/test/pbxFile.js b/test/pbxFile.js
index 5a7b317..4f0d1a2 100644
--- a/test/pbxFile.js
+++ b/test/pbxFile.js
@@ -278,5 +278,13 @@ exports['settings'] = {
test.deepEqual({COMPILER_FLAGS:'"-std=c++11 -fno-objc-arc"'}, sourceFile.settings);
test.done();
+ },
+
+ 'should be .appex if {explicitFileType:\'"wrapper.app-extension"\'} specified': function (test) {
+ var sourceFile = new pbxFile('AppExtension',
+ { explicitFileType: '"wrapper.app-extension"'});
+
+ test.equal('AppExtension.appex', sourceFile.basename);
+ test.done();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org