@@ -94,9 +94,14 @@ function defaultEncoding(fileRef) {
94
94
}
95
95
96
96
function detectGroup ( fileRef ) {
97
- var filetype = fileRef . lastKnownFileType || fileRef . explicitFileType ,
97
+ var extension = path . extname ( fileRef . basename ) . substring ( 1 ) ,
98
+ filetype = fileRef . lastKnownFileType || fileRef . explicitFileType ,
98
99
groupName = GROUP_BY_FILETYPE [ unquoted ( filetype ) ] ;
99
100
101
+ if ( extension === 'xcdatamodeld' ) {
102
+ return 'Sources' ;
103
+ }
104
+
100
105
if ( ! groupName ) {
101
106
return DEFAULT_GROUP ;
102
107
}
@@ -105,18 +110,18 @@ function detectGroup(fileRef) {
105
110
}
106
111
107
112
function detectSourcetree ( fileRef ) {
108
-
113
+
109
114
var filetype = fileRef . lastKnownFileType || fileRef . explicitFileType ,
110
115
sourcetree = SOURCETREE_BY_FILETYPE [ unquoted ( filetype ) ] ;
111
116
112
117
if ( fileRef . explicitFileType ) {
113
118
return DEFAULT_PRODUCT_SOURCETREE ;
114
119
}
115
-
120
+
116
121
if ( fileRef . customFramework ) {
117
122
return DEFAULT_SOURCETREE ;
118
123
}
119
-
124
+
120
125
if ( ! sourcetree ) {
121
126
return DEFAULT_SOURCETREE ;
122
127
}
@@ -131,7 +136,7 @@ function defaultPath(fileRef, filePath) {
131
136
if ( fileRef . customFramework ) {
132
137
return filePath ;
133
138
}
134
-
139
+
135
140
if ( defaultPath ) {
136
141
return path . join ( defaultPath , path . basename ( filePath ) ) ;
137
142
}
@@ -151,23 +156,22 @@ function defaultGroup(fileRef) {
151
156
152
157
function pbxFile ( filepath , opt ) {
153
158
var opt = opt || { } ;
154
-
159
+
155
160
self = this ;
156
161
162
+ this . basename = path . basename ( filepath ) ;
157
163
this . lastKnownFileType = opt . lastKnownFileType || detectType ( filepath ) ;
158
164
this . group = detectGroup ( self ) ;
159
165
160
166
// for custom frameworks
161
167
if ( opt . customFramework == true ) {
162
168
this . customFramework = true ;
163
- this . dirname = path . dirname ( filepath ) ;
169
+ this . dirname = path . dirname ( filepath ) . replace ( / \\ / g , '/' ) ;
164
170
}
165
171
166
- this . basename = path . basename ( filepath ) ;
167
- this . path = defaultPath ( this , filepath ) ;
172
+ this . path = defaultPath ( this , filepath ) . replace ( / \\ / g, '/' ) ;
168
173
this . fileEncoding = this . defaultEncoding = opt . defaultEncoding || defaultEncoding ( self ) ;
169
174
170
-
171
175
// When referencing products / build output files
172
176
if ( opt . explicitFileType ) {
173
177
this . explicitFileType = opt . explicitFileType ;
@@ -189,6 +193,14 @@ function pbxFile(filepath, opt) {
189
193
this . settings = { } ;
190
194
this . settings . COMPILER_FLAGS = util . format ( '"%s"' , opt . compilerFlags ) ;
191
195
}
196
+
197
+ if ( opt . sign ) {
198
+ if ( ! this . settings )
199
+ this . settings = { } ;
200
+ if ( ! this . settings . ATTRIBUTES )
201
+ this . settings . ATTRIBUTES = [ ] ;
202
+ this . settings . ATTRIBUTES . push ( 'CodeSignOnCopy' ) ;
203
+ }
192
204
}
193
205
194
206
module . exports = pbxFile ;
0 commit comments