From ca8ae3a36269ca34bd59d5137daf1ff69d0c72bc Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Mon, 30 Mar 2015 13:42:57 +0300 Subject: [PATCH] Delete destination app dir when preparing project Delete dir where app will be copied on prepare. If we do not delete it, on Linux and Mac we receive EEXIST errors for symlinks inside app directory. Symlinks are common scenario when node_modules are used. Fixes https://github.com/NativeScript/nativescript-cli/issues/394 --- lib/services/platform-service.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index ecc1cf1cc5..e37967a746 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -142,6 +142,9 @@ export class PlatformService implements IPlatformService { // Copy app folder to native project var appSourceDirectoryPath = path.join(this.$projectData.projectDir, constants.APP_FOLDER_NAME); + + // Delete the destination app in order to prevent EEXIST errors when symlinks are used. + this.$fs.deleteDirectory(path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME)).wait(); shell.cp("-R", appSourceDirectoryPath, platformData.appDestinationDirectoryPath); // Copy App_Resources to project root folder