@@ -23,14 +23,13 @@ var util = require('util'),
2323 fork = require ( 'child_process' ) . fork ,
2424 pbxWriter = require ( './pbxWriter' ) ,
2525 pbxFile = require ( './pbxFile' ) . pbxFile ,
26- pbxFileTypes = require ( './pbxFile' ) . fileTypes ,
26+ isSourceOrHeaderFileType = require ( './pbxFile' ) . isSourceOrHeaderFileType ,
27+ isHeaderFileType = require ( './pbxFile' ) . isHeaderFileType ,
2728 fs = require ( 'fs' ) ,
2829 parser = require ( './parser/pbxproj' ) ,
2930 plist = require ( 'simple-plist' ) ,
3031 COMMENT_KEY = / _ c o m m e n t $ / ,
31- NO_SPECIAL_SYMBOLS = / ^ [ a - z A - Z 0 - 9 _ \. \$ ] + \. [ a - z A - Z ] + $ / ,
32- HEADER_FILE_TYPE_SUFFIX = ".h" ,
33- SOURCE_CODE_FILE_TYPE_PREFIX = "sourcecode." ;
32+ NO_SPECIAL_SYMBOLS = / ^ [ a - z A - Z 0 - 9 _ \. \$ ] + \. [ a - z A - Z ] + $ / ;
3433
3534function pbxProject ( filename ) {
3635 if ( ! ( this instanceof pbxProject ) )
@@ -560,12 +559,12 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT
560559 pbxGroup . children . push ( pbxGroupChild ( file ) ) ;
561560 var files = fs . readdirSync ( filePath ) . map ( p => $path . join ( filePath , p ) ) ;
562561 this . addPbxGroup ( files , $path . basename ( filePath ) , filePath , null , { uuid : file . uuid } ) ;
563- } else if ( file . lastType . startsWith ( SOURCE_CODE_FILE_TYPE_PREFIX ) ) {
562+ } else if ( isSourceOrHeaderFileType ( file . lastType ) ) {
564563 file . uuid = this . generateUuid ( ) ;
565564 file . fileRef = this . generateUuid ( ) ;
566565 this . addToPbxFileReferenceSection ( file ) ; // PBXFileReference
567566 this . addToPbxBuildFileSection ( file ) ; // PBXBuildFile
568- if ( ! file . lastType . endsWith ( HEADER_FILE_TYPE_SUFFIX ) ) {
567+ if ( ! isHeaderFileType ( file . lastType ) ) {
569568 this . addToPbxSourcesBuildPhase ( file ) ;
570569 }
571570 pbxGroup . children . push ( pbxGroupChild ( file ) ) ;
@@ -1605,11 +1604,11 @@ function pbxFileReferenceObj(file) {
16051604 fileObject . name = fileObject . name . replace ( / \" / g, "\\\"" ) ;
16061605 fileObject . path = fileObject . path . replace ( / \" / g, "\\\"" ) ;
16071606 }
1608-
1607+
16091608 if ( ! file . basename . match ( NO_SPECIAL_SYMBOLS ) ) {
16101609 fileObject . name = "\"" + fileObject . name + "\"" ;
16111610 }
1612-
1611+
16131612 if ( ! file . path . match ( NO_SPECIAL_SYMBOLS ) ) {
16141613 fileObject . path = "\"" + fileObject . path + "\"" ;
16151614 }
0 commit comments