@@ -75,8 +75,6 @@ var FileInfo = CoreObject.extend({
7575 var pathParts = this . sourceRelativePath . split ( '/' ) ;
7676 var typeFolder = pathParts [ 1 ] ;
7777
78-
79-
8078 var podType = typeForPodFile ( this . sourceRelativePath ) ;
8179 var arePodsNamespaced = hasPodNamespace ( this . podModulePrefix ) ;
8280
@@ -95,16 +93,19 @@ var FileInfo = CoreObject.extend({
9593 }
9694 }
9795
96+ strippedRelativePath = this . sourceRelativePath ;
97+
9898 // default/classic/namespaced-pods
99- pathRootRegex = new RegExp ( '(app\/)?' + this . podModulePrefix + '\/(components\/)?' ) ;
99+ if ( this . podModulePrefix ) {
100+ pathRootRegex = new RegExp ( '(app\/)?' + this . podModulePrefix + '\/(components\/)?' ) ;
101+ strippedRelativePath = strippedRelativePath . replace ( pathRootRegex , '' ) ; // don't care if path begins with pods;
102+ }
100103
101- strippedRelativePath = this . sourceRelativePath
102- . replace ( pathRootRegex , '' ) // don't care if path begins with pods
104+ strippedRelativePath = strippedRelativePath
103105 . replace ( new RegExp ( '^' + this . sourceRoot + '/' + typeFolder + '/' ) , '' ) // remove leading type dir
104106 . replace ( new RegExp ( this . ext + '$' ) , '' ) // remove extension
105107 . replace ( new RegExp ( '/' + this . type + '$' ) , '' ) ; // remove trailing type
106108
107-
108109 if ( ! arePodsNamespaced ) {
109110 if ( podType ) {
110111 fileName = pathParts [ pathParts . length - 1 ] ;
@@ -121,23 +122,6 @@ var FileInfo = CoreObject.extend({
121122 . replace ( new RegExp ( this . ext + '$' ) , '' ) // remove extension
122123 . replace ( new RegExp ( '/' + this . type + '$' ) , '' ) ; // remove trailing type
123124 }
124-
125- // for other files (adapters, serializers, helpers, initializers, etc)
126- if ( type === undefined ) {
127- pathRootRegex = new RegExp ( '(app\/)?' ) ;
128- type = pathParts [ 1 ] ;
129- fileName = pathParts [ pathParts . length - 1 ] ;
130- typeFolder = inflection . pluralize ( type ) ;
131-
132-
133- strippedRelativePath = this . sourceRelativePath
134- . replace ( pathRootRegex , '' )
135- . replace ( new RegExp ( type + '/' ) , '' )
136- . replace ( new RegExp ( '^' + this . sourceRoot + '/' + typeFolder + '/' ) , '' ) // remove leading type dir
137- . replace ( new RegExp ( this . ext + '$' ) , '' ) // remove extension
138- . replace ( new RegExp ( '/' + this . type ) , '' ) ; // remove trailing type
139-
140- }
141125 }
142126
143127 var parts = strippedRelativePath . split ( '/' ) ;
0 commit comments