@@ -94,17 +94,13 @@ export class ProjectData implements IProjectData {
94
94
projectDir = this . projectDir ;
95
95
}
96
96
97
- const configNSFilePath = path . join ( projectDir , constants . CONFIG_NS_FILE_NAME ) ;
97
+ const configNS = this . getNsConfig ( projectDir ) ;
98
98
let absoluteAppResourcesDirPath : string ;
99
99
100
- if ( this . $fs . exists ( configNSFilePath ) ) {
101
- const configNS = this . $fs . readJson ( configNSFilePath ) ;
102
-
103
- if ( configNS && configNS [ constants . CONFIG_NS_APP_RESOURCES_ENTRY ] ) {
104
- const appResourcesDirPath = configNS [ constants . CONFIG_NS_APP_RESOURCES_ENTRY ] ;
100
+ if ( configNS && configNS [ constants . CONFIG_NS_APP_RESOURCES_ENTRY ] ) {
101
+ const appResourcesDirPath = configNS [ constants . CONFIG_NS_APP_RESOURCES_ENTRY ] ;
105
102
106
- absoluteAppResourcesDirPath = path . resolve ( projectDir , appResourcesDirPath ) ;
107
- }
103
+ absoluteAppResourcesDirPath = path . resolve ( projectDir , appResourcesDirPath ) ;
108
104
}
109
105
110
106
return absoluteAppResourcesDirPath || path . join ( this . getAppDirectoryPath ( projectDir ) , constants . APP_RESOURCES_FOLDER_NAME ) ;
@@ -115,22 +111,28 @@ export class ProjectData implements IProjectData {
115
111
projectDir = this . projectDir ;
116
112
}
117
113
118
- const configNSFilePath = path . join ( projectDir , constants . CONFIG_NS_FILE_NAME ) ;
114
+ const configNS = this . getNsConfig ( projectDir ) ;
119
115
let absoluteAppDirPath : string ;
120
116
121
- if ( this . $fs . exists ( configNSFilePath ) ) {
122
- const configNS = this . $fs . readJson ( configNSFilePath ) ;
123
-
124
- if ( configNS && configNS [ constants . CONFIG_NS_APP_ENTRY ] ) {
125
- const appDirPath = configNS [ constants . CONFIG_NS_APP_ENTRY ] ;
117
+ if ( configNS && configNS [ constants . CONFIG_NS_APP_ENTRY ] ) {
118
+ const appDirPath = configNS [ constants . CONFIG_NS_APP_ENTRY ] ;
126
119
127
- absoluteAppDirPath = path . resolve ( projectDir , appDirPath ) ;
128
- }
120
+ absoluteAppDirPath = path . resolve ( projectDir , appDirPath ) ;
129
121
}
130
122
131
123
return absoluteAppDirPath || path . join ( projectDir , constants . APP_FOLDER_NAME ) ;
132
124
}
133
125
126
+ private getNsConfig ( projectDir : string ) : Object {
127
+ const configNSFilePath = path . join ( projectDir , constants . CONFIG_NS_FILE_NAME ) ;
128
+
129
+ if ( ! this . $fs . exists ( configNSFilePath ) ) {
130
+ return null ;
131
+ }
132
+
133
+ return this . $fs . readJson ( configNSFilePath ) ;
134
+ }
135
+
134
136
private getProjectType ( ) : string {
135
137
let detectedProjectType = _ . find ( ProjectData . PROJECT_TYPES , ( projectType ) => projectType . isDefaultProjectType ) . type ;
136
138
0 commit comments