@@ -76,8 +76,6 @@ var FileInfo = CoreObject.extend({
7676 var pathParts = this . sourceRelativePath . split ( '/' ) ;
7777 var typeFolder = pathParts [ 1 ] ;
7878
79-
80-
8179 var podType = typeForPodFile ( this . sourceRelativePath ) ;
8280 var arePodsNamespaced = hasPodNamespace ( this . podModulePrefix ) ;
8381
@@ -96,16 +94,19 @@ var FileInfo = CoreObject.extend({
9694 }
9795 }
9896
97+ strippedRelativePath = this . sourceRelativePath ;
98+
9999 // default/classic/namespaced-pods
100- pathRootRegex = new RegExp ( '(app\/)?' + this . podModulePrefix + '\/(components\/)?' ) ;
100+ if ( this . podModulePrefix ) {
101+ pathRootRegex = new RegExp ( '(app\/)?' + this . podModulePrefix + '\/(components\/)?' ) ;
102+ strippedRelativePath = strippedRelativePath . replace ( pathRootRegex , '' ) ; // don't care if path begins with pods;
103+ }
101104
102- strippedRelativePath = this . sourceRelativePath
103- . replace ( pathRootRegex , '' ) // don't care if path begins with pods
105+ strippedRelativePath = strippedRelativePath
104106 . replace ( new RegExp ( '^' + this . sourceRoot + '/' + typeFolder + '/' ) , '' ) // remove leading type dir
105107 . replace ( new RegExp ( this . ext + '$' ) , '' ) // remove extension
106108 . replace ( new RegExp ( '/' + this . type + '$' ) , '' ) ; // remove trailing type
107109
108-
109110 if ( ! arePodsNamespaced ) {
110111 if ( podType ) {
111112 fileName = pathParts [ pathParts . length - 1 ] ;
@@ -122,23 +123,6 @@ var FileInfo = CoreObject.extend({
122123 . replace ( new RegExp ( this . ext + '$' ) , '' ) // remove extension
123124 . replace ( new RegExp ( '/' + this . type + '$' ) , '' ) ; // remove trailing type
124125 }
125-
126- // for other files (adapters, serializers, helpers, initializers, etc)
127- if ( type === undefined ) {
128- pathRootRegex = new RegExp ( '(app\/)?' ) ;
129- type = pathParts [ 1 ] ;
130- fileName = pathParts [ pathParts . length - 1 ] ;
131- typeFolder = inflection . pluralize ( type ) ;
132-
133-
134- strippedRelativePath = this . sourceRelativePath
135- . replace ( pathRootRegex , '' )
136- . replace ( new RegExp ( type + '/' ) , '' )
137- . replace ( new RegExp ( '^' + this . sourceRoot + '/' + typeFolder + '/' ) , '' ) // remove leading type dir
138- . replace ( new RegExp ( this . ext + '$' ) , '' ) // remove extension
139- . replace ( new RegExp ( '/' + this . type ) , '' ) ; // remove trailing type
140-
141- }
142126 }
143127
144128 var parts = strippedRelativePath . split ( '/' ) ;
0 commit comments