@@ -113,15 +113,15 @@ export class ProjectService implements IProjectService {
113113 this . $logger . trace ( `Template version is ${ templateVersion } ` ) ;
114114 let destinationDir = "" ;
115115 switch ( templateVersion ) {
116- case constants . TemplateVersions . v2 :
117- destinationDir = projectDir ;
118- break ;
119116 case constants . TemplateVersions . v1 :
120- default :
121117 const appDestinationPath = this . $projectData . getAppDirectoryPath ( projectDir ) ;
122118 this . $fs . createDirectory ( appDestinationPath ) ;
123119 destinationDir = appDestinationPath ;
124120 break ;
121+ case constants . TemplateVersions . v2 :
122+ default :
123+ destinationDir = projectDir ;
124+ break ;
125125 }
126126
127127 this . $logger . trace ( `Copying application from '${ realTemplatePath } ' into '${ destinationDir } '.` ) ;
@@ -146,20 +146,25 @@ export class ProjectService implements IProjectService {
146146 ignoreScripts : false
147147 } ) ;
148148
149- const obsoleteAppResourcesPath = path . join ( projectDir ,
150- constants . NODE_MODULES_FOLDER_NAME ,
151- defaultTemplateName ,
152- constants . APP_RESOURCES_FOLDER_NAME ) ;
153-
154- const defaultTemplateAppResourcesPath = path . join ( projectDir ,
155- constants . NODE_MODULES_FOLDER_NAME ,
156- defaultTemplateName ,
157- constants . APP_FOLDER_NAME ,
158- constants . APP_RESOURCES_FOLDER_NAME ) ;
149+ const defaultTemplatePath = path . join ( projectDir , constants . NODE_MODULES_FOLDER_NAME , defaultTemplateName ) ;
150+ const defaultTemplateVersion = this . $projectTemplatesService . getTemplateVersion ( defaultTemplatePath ) ;
151+
152+ let defaultTemplateAppResourcesPath : string = null ;
153+ switch ( defaultTemplateVersion ) {
154+ case constants . TemplateVersions . v1 :
155+ defaultTemplateAppResourcesPath = path . join ( projectDir ,
156+ constants . NODE_MODULES_FOLDER_NAME ,
157+ defaultTemplateName ,
158+ constants . APP_RESOURCES_FOLDER_NAME ) ;
159+ break ;
160+ case constants . TemplateVersions . v2 :
161+ default :
162+ const defaultTemplateProjectData = this . $projectDataService . getProjectData ( defaultTemplatePath ) ;
163+ defaultTemplateAppResourcesPath = defaultTemplateProjectData . appResourcesDirectoryPath ;
164+ }
159165
160- const pathToAppResources = this . $fs . exists ( defaultTemplateAppResourcesPath ) ? defaultTemplateAppResourcesPath : obsoleteAppResourcesPath ;
161- if ( this . $fs . exists ( pathToAppResources ) ) {
162- shelljs . cp ( '-R' , pathToAppResources , appPath ) ;
166+ if ( defaultTemplateAppResourcesPath && this . $fs . exists ( defaultTemplateAppResourcesPath ) ) {
167+ shelljs . cp ( '-R' , defaultTemplateAppResourcesPath , appPath ) ;
163168 }
164169
165170 await this . $npm . uninstall ( defaultTemplateName , { save : true } , projectDir ) ;
0 commit comments