@@ -94,9 +94,14 @@ function defaultEncoding(fileRef) {
9494}
9595
9696function detectGroup ( fileRef ) {
97- var filetype = fileRef . lastKnownFileType || fileRef . explicitFileType ,
97+ var extension = path . extname ( fileRef . basename ) . substring ( 1 ) ,
98+ filetype = fileRef . lastKnownFileType || fileRef . explicitFileType ,
9899 groupName = GROUP_BY_FILETYPE [ unquoted ( filetype ) ] ;
99100
101+ if ( extension === 'xcdatamodeld' ) {
102+ return 'Sources' ;
103+ }
104+
100105 if ( ! groupName ) {
101106 return DEFAULT_GROUP ;
102107 }
@@ -105,18 +110,18 @@ function detectGroup(fileRef) {
105110}
106111
107112function detectSourcetree ( fileRef ) {
108-
113+
109114 var filetype = fileRef . lastKnownFileType || fileRef . explicitFileType ,
110115 sourcetree = SOURCETREE_BY_FILETYPE [ unquoted ( filetype ) ] ;
111116
112117 if ( fileRef . explicitFileType ) {
113118 return DEFAULT_PRODUCT_SOURCETREE ;
114119 }
115-
120+
116121 if ( fileRef . customFramework ) {
117122 return DEFAULT_SOURCETREE ;
118123 }
119-
124+
120125 if ( ! sourcetree ) {
121126 return DEFAULT_SOURCETREE ;
122127 }
@@ -131,7 +136,7 @@ function defaultPath(fileRef, filePath) {
131136 if ( fileRef . customFramework ) {
132137 return filePath ;
133138 }
134-
139+
135140 if ( defaultPath ) {
136141 return path . join ( defaultPath , path . basename ( filePath ) ) ;
137142 }
@@ -151,23 +156,22 @@ function defaultGroup(fileRef) {
151156
152157function pbxFile ( filepath , opt ) {
153158 var opt = opt || { } ;
154-
159+
155160 self = this ;
156161
162+ this . basename = path . basename ( filepath ) ;
157163 this . lastKnownFileType = opt . lastKnownFileType || detectType ( filepath ) ;
158164 this . group = detectGroup ( self ) ;
159165
160166 // for custom frameworks
161167 if ( opt . customFramework == true ) {
162168 this . customFramework = true ;
163- this . dirname = path . dirname ( filepath ) ;
169+ this . dirname = path . dirname ( filepath ) . replace ( / \\ / g , '/' ) ;
164170 }
165171
166- this . basename = path . basename ( filepath ) ;
167- this . path = defaultPath ( this , filepath ) ;
172+ this . path = defaultPath ( this , filepath ) . replace ( / \\ / g, '/' ) ;
168173 this . fileEncoding = this . defaultEncoding = opt . defaultEncoding || defaultEncoding ( self ) ;
169174
170-
171175 // When referencing products / build output files
172176 if ( opt . explicitFileType ) {
173177 this . explicitFileType = opt . explicitFileType ;
@@ -189,6 +193,14 @@ function pbxFile(filepath, opt) {
189193 this . settings = { } ;
190194 this . settings . COMPILER_FLAGS = util . format ( '"%s"' , opt . compilerFlags ) ;
191195 }
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+ }
192204}
193205
194206module . exports = pbxFile ;
0 commit comments