From 9c5c489d86802273cd201366965612c2271de7f8 Mon Sep 17 00:00:00 2001 From: Fatme Havaluova Date: Wed, 22 Jul 2015 13:48:42 +0300 Subject: [PATCH] Still validating library path --- lib/commands/add-library.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/commands/add-library.ts b/lib/commands/add-library.ts index 11cc8cc399..f804f99dfd 100644 --- a/lib/commands/add-library.ts +++ b/lib/commands/add-library.ts @@ -26,12 +26,20 @@ export class AddLibraryCommand implements ICommand { if (args.length !== 2) { this.$errors.fail("This command needs two parameters."); } - + + let platform = args[0]; + let platformLowerCase = platform.toLowerCase(); let libraryPath = path.resolve(args[1]); - if(!this.$fs.exists(path.join(libraryPath, "project.properties")).wait()) { - let files = this.$fs.enumerateFilesInDirectorySync(libraryPath); - if(!_.any(files, file => path.extname(file) === ".jar")) { - this.$errors.failWithoutHelp("Invalid library path. Ensure that the library path is the file path to a directory containing one or more `*.jar` files or to a directory containing the `project.properties` files."); + if(platformLowerCase === "android") { + if(!this.$fs.exists(path.join(libraryPath, "project.properties")).wait()) { + let files = this.$fs.enumerateFilesInDirectorySync(libraryPath); + if(!_.any(files, file => path.extname(file) === ".jar")) { + this.$errors.failWithoutHelp("Invalid library path. Ensure that the library path is the file path to a directory containing one or more `*.jar` files or to a directory containing the `project.properties` files."); + } + } + } else if(platformLowerCase === "ios") { + if(path.extname(libraryPath) !== ".framework") { + this.$errors.failWithoutHelp("Invalid library path. Ensure that the library path is a Cocoa Touch Framework with all build architectures enabled."); } }