Skip to content

Commit a59dfc2

Browse files
committed
pbxFile: Replace lookup via Product Type by lookup via Filetype
1 parent f2514b5 commit a59dfc2

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

lib/pbxFile.js

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,6 @@ var FILETYPE_BY_EXTENSION = {
3030
xctest: 'wrapper.cfbundle',
3131
xib: 'file.xib'
3232
},
33-
EXTENSION_BY_PRODUCTTYPE = {
34-
'com.apple.product-type.application': 'app',
35-
'com.apple.product-type.application.watchapp': 'app',
36-
'com.apple.product-type.app-extension': 'appex',
37-
'com.apple.product-type.watchkit-extension': 'appex',
38-
'com.apple.product-type.bundle': 'bundle',
39-
'com.apple.product-type.bundle.unit-test': 'xctest',
40-
'com.apple.product-type.framework': 'framework',
41-
'com.apple.product-type.library.dynamic': 'dylib',
42-
'com.apple.product-type.library.static': 'a',
43-
'com.apple.product-type.tool': ''
44-
},
4533
GROUP_BY_FILETYPE = {
4634
'archive.ar': 'Frameworks',
4735
'compiled.mach-o.dylib': 'Frameworks',
@@ -82,13 +70,14 @@ function detectType(filePath) {
8270
}
8371

8472
function defaultExtension(fileRef) {
85-
var extension = EXTENSION_BY_PRODUCTTYPE[fileRef.explicitFileType];
73+
var filetype = fileRef.explicitFileType.replace(/^"|"$/g, '');
8674

87-
if (!extension) {
88-
return;
75+
for(var extension in FILETYPE_BY_EXTENSION) {
76+
if(FILETYPE_BY_EXTENSION.hasOwnProperty(extension) ) {
77+
if(FILETYPE_BY_EXTENSION[extension] === filetype )
78+
return extension;
79+
}
8980
}
90-
91-
return extension;
9281
}
9382

9483
function defaultEncoding(fileRef) {
@@ -175,7 +164,7 @@ function pbxFile(filepath, opt) {
175164

176165
this.sourceTree = opt.sourceTree || defaultSourcetree(this);
177166

178-
if (opt.weak && opt.weak === true)
167+
if (opt.weak && opt.weak === true)
179168
this.settings = { ATTRIBUTES: ['Weak'] };
180169

181170
if (opt.compilerFlags) {

0 commit comments

Comments
 (0)