From 75c2121c1ad8bbea38e9668bc7908eb11731c66b Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Fri, 8 Jan 2016 16:26:24 +0200 Subject: [PATCH] Fix baseConfig option for iOS When `--baseConfig` option is used for `tns platform add ios`, the command fails with ENOTEMPTY. The reason is that we copy the baseConfig file before creating correct directories and when we try to rename __PROJECT_NAME__ dir to real project name, it fails as we have already created this dir. --- lib/common | 2 +- lib/services/platform-service.ts | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/common b/lib/common index 4533e2a011..eec8ca8b7e 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit 4533e2a011ef76064da8158dd764b207fed26e51 +Subproject commit eec8ca8b7e7ad1a0baf07cd828ad16900ee6fe51 diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index dfaedb6056..40d1ecee9a 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -113,11 +113,6 @@ export class PlatformService implements IPlatformService { let sourceFrameworkDir = isFrameworkPathDirectory && this.$options.symlink ? path.join(this.$options.frameworkPath, "framework") : frameworkDir; platformData.platformProjectService.createProject(path.resolve(sourceFrameworkDir), installedVersion).wait(); - if(this.$options.baseConfig) { - let newConfigFile = path.resolve(this.$options.baseConfig); - this.$logger.trace(`Replacing '${platformData.configurationFilePath}' with '${newConfigFile}'.`); - this.$fs.copyFile(newConfigFile, platformData.configurationFilePath).wait(); - } if(isFrameworkPathDirectory || isFrameworkPathNotSymlinkedFile) { // Need to remove unneeded node_modules folder @@ -128,6 +123,12 @@ export class PlatformService implements IPlatformService { platformData.platformProjectService.interpolateData().wait(); platformData.platformProjectService.afterCreateProject(platformData.projectRoot).wait(); + if(this.$options.baseConfig) { + let newConfigFile = path.resolve(this.$options.baseConfig); + this.$logger.trace(`Replacing '${platformData.configurationFilePath}' with '${newConfigFile}'.`); + this.$fs.copyFile(newConfigFile, platformData.configurationFilePath).wait(); + } + this.$projectDataService.initialize(this.$projectData.projectDir); this.$projectDataService.setValue(platformData.frameworkPackageName, {version: installedVersion}).wait();