Skip to content

Still validating library path #675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions lib/commands/add-library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
}

Expand Down