Skip to content

Commit 84e8fb6

Browse files
FatmeFatme
Fatme
authored and
Fatme
committed
Merge pull request #562 from NativeScript/fatme/validate-copy-from
Validate copy-from option
2 parents bf388df + 5357786 commit 84e8fb6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/services/project-service.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,16 @@ export class ProjectService implements IProjectService {
3535
var customAppPath = this.getCustomAppPath();
3636
if(customAppPath) {
3737
customAppPath = path.resolve(customAppPath);
38+
if(!this.$fs.exists(customAppPath).wait()) {
39+
this.$errors.failWithoutHelp(`The specified path "${customAppPath}" doesn't exist. Check that you specified the path correctly and try again.`);
40+
}
41+
42+
let customAppContents = this.$fs.enumerateFilesInDirectorySync(customAppPath);
43+
if(customAppContents.length === 0) {
44+
this.$errors.failWithoutHelp(`The specified path "${customAppPath}" is empty directory.`);
45+
}
3846
}
39-
47+
4048
if(this.$fs.exists(projectDir).wait() && !this.$fs.isEmptyDir(projectDir).wait()) {
4149
this.$errors.fail("Path already exists and is not empty %s", projectDir);
4250
}

0 commit comments

Comments
 (0)