1
- var path = require ( 'path' ) ,
1
+ var $ path = require ( 'path' ) ,
2
2
util = require ( 'util' ) ,
3
3
M_EXTENSION = / [ . ] m $ / , SOURCE_FILE = 'sourcecode.c.objc' ,
4
+ C_EXTENSION = / [ . ] c $ / , C_SOURCE_FILE = 'sourcecode.c' ,
4
5
H_EXTENSION = / [ . ] h $ / , HEADER_FILE = 'sourcecode.c.h' ,
6
+ MM_EXTENSION = / [ . ] m m $ / , MM_SOURCE_FILE = 'sourcecode.cpp.objcpp' ,
7
+ HPP_EXTENSION = / [ . ] ( h p p | h x x | h \+ \+ | h h ) $ / , CPP_HEADER_FILE = 'sourcecode.cpp.h' ,
8
+ CPP_EXTENSION = / [ . ] ( c p p | c x x | c \+ \+ | c c ) $ / , CPP_SOURCE_FILE = 'sourcecode.cpp.cpp' ,
5
9
BUNDLE_EXTENSION = / [ . ] b u n d l e $ / , BUNDLE = '"wrapper.plug-in"' ,
6
10
XIB_EXTENSION = / [ . ] x i b $ / , XIB_FILE = 'file.xib' ,
7
11
DYLIB_EXTENSION = / [ . ] d y l i b $ / , DYLIB = '"compiled.mach-o.dylib"' ,
@@ -11,13 +15,42 @@ var path = require('path'),
11
15
DEFAULT_SOURCE_TREE = '"<group>"' ,
12
16
DEFAULT_FILE_ENCODING = 4 ;
13
17
18
+ function fileTypes ( ) {
19
+ return {
20
+ SOURCE_FILE ,
21
+ C_SOURCE_FILE ,
22
+ HEADER_FILE ,
23
+ MM_SOURCE_FILE ,
24
+ CPP_HEADER_FILE ,
25
+ CPP_SOURCE_FILE ,
26
+ BUNDLE ,
27
+ XIB_FILE ,
28
+ FRAMEWORK ,
29
+ DYLIB ,
30
+ ARCHIVE ,
31
+ PNG_IMAGE ,
32
+ }
33
+ }
34
+
14
35
function detectLastType ( path ) {
15
36
if ( M_EXTENSION . test ( path ) )
16
37
return SOURCE_FILE ;
17
38
39
+ if ( C_EXTENSION . test ( path ) )
40
+ return C_SOURCE_FILE ;
41
+
18
42
if ( H_EXTENSION . test ( path ) )
19
43
return HEADER_FILE ;
20
44
45
+ if ( MM_EXTENSION . test ( path ) )
46
+ return MM_SOURCE_FILE ;
47
+
48
+ if ( CPP_EXTENSION . test ( path ) )
49
+ return CPP_SOURCE_FILE ;
50
+
51
+ if ( HPP_EXTENSION . test ( path ) )
52
+ return CPP_HEADER_FILE ;
53
+
21
54
if ( BUNDLE_EXTENSION . test ( path ) )
22
55
return BUNDLE ;
23
56
@@ -82,17 +115,17 @@ function pbxFile(filepath, opt) {
82
115
// for custom frameworks
83
116
if ( opt . customFramework == true ) {
84
117
this . customFramework = true ;
85
- this . dirname = path . dirname ( filepath ) ;
118
+ this . dirname = $ path. dirname ( filepath ) ;
86
119
}
87
120
88
- this . basename = path . basename ( filepath ) ;
121
+ this . basename = $ path. basename ( filepath ) ;
89
122
this . path = correctPath ( this , filepath ) ;
90
123
this . group = correctGroup ( this ) ;
91
124
92
125
this . sourceTree = opt . sourceTree || defaultSourceTree ( this ) ;
93
126
this . fileEncoding = opt . fileEncoding || fileEncoding ( this ) ;
94
127
95
- if ( opt . weak && opt . weak === true )
128
+ if ( opt . weak && opt . weak === true )
96
129
this . settings = { ATTRIBUTES : [ 'Weak' ] } ;
97
130
98
131
if ( opt . compilerFlags ) {
@@ -102,4 +135,7 @@ function pbxFile(filepath, opt) {
102
135
}
103
136
}
104
137
105
- module . exports = pbxFile ;
138
+ module . exports = {
139
+ pbxFile : pbxFile ,
140
+ fileTypes : fileTypes
141
+ }
0 commit comments