From 5357786729eeb4c31bc056a63fac19592900ad0f Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 14 Jun 2015 10:22:33 +0300 Subject: [PATCH] Validate copy-from option --- lib/services/project-service.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/services/project-service.ts b/lib/services/project-service.ts index e27398cd8f..a9f15591c5 100644 --- a/lib/services/project-service.ts +++ b/lib/services/project-service.ts @@ -35,8 +35,16 @@ export class ProjectService implements IProjectService { var customAppPath = this.getCustomAppPath(); if(customAppPath) { customAppPath = path.resolve(customAppPath); + if(!this.$fs.exists(customAppPath).wait()) { + this.$errors.failWithoutHelp(`The specified path "${customAppPath}" doesn't exist. Check that you specified the path correctly and try again.`); + } + + let customAppContents = this.$fs.enumerateFilesInDirectorySync(customAppPath); + if(customAppContents.length === 0) { + this.$errors.failWithoutHelp(`The specified path "${customAppPath}" is empty directory.`); + } } - + if(this.$fs.exists(projectDir).wait() && !this.$fs.isEmptyDir(projectDir).wait()) { this.$errors.fail("Path already exists and is not empty %s", projectDir); }