Skip to content

Commit

Permalink
Fix issue with pulling remote artifacts. Removed install checker
Browse files Browse the repository at this point in the history
  • Loading branch information
SamCarlberg committed Sep 26, 2016
1 parent 9b2b26b commit 285f65e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 60 deletions.

This file was deleted.

36 changes: 15 additions & 21 deletions src/main/java/edu/wpi/first/wpilib/opencv/installer/Installer.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package edu.wpi.first.wpilib.opencv.installer;

import edu.wpi.first.wpilib.opencv.installer.platform.Platform;

import lombok.experimental.UtilityClass;

import java.io.File;
Expand Down Expand Up @@ -143,12 +144,6 @@ private static void install(ArtifactType type, String location) throws IOExcepti
// Force location to be an absolute path
location = Paths.get(location).toAbsolutePath().toString();
}
if (!overridePlatform && InstallChecker.isInstalled(type, location, openCvVersion)) {
System.out.println("Artifacts for the version " + openCvVersion + " " + type.getArtifactName() + " have already been installed!");
if (!overwrite) {
return;
}
}
String artifactId;
String v = openCvVersion;
String classifier = null;
Expand Down Expand Up @@ -199,9 +194,6 @@ private static void install(ArtifactType type, String location) throws IOExcepti
unzipped = dst.getParent();
}
copyAll(unzipped, Paths.get(installLocation));
if (!overridePlatform) {
InstallChecker.registerSuccessfulInstall(type, location, openCvVersion);
}
}

private static URL resolveRemote(String artifactId, String version, String classifier) throws MalformedURLException {
Expand Down Expand Up @@ -272,19 +264,21 @@ private static void copyAll(Path sourceDir, Path dstDir) throws IOException {

private static void unsafeCopy(Path src, Path dst) {
try {
if (overwrite) {
if (dst.getParent() != null && !Files.exists(dst.getParent())) {
Files.createDirectories(dst.getParent());
}
if (Files.isDirectory(src)) {
copyAll(src, dst);
} else {
System.out.println(" Copying " + src.toAbsolutePath() + " to " + dst.toAbsolutePath());
if (dst.getParent() != null && !Files.exists(dst.getParent())) {
Files.createDirectories(dst.getParent());
}
if (Files.isDirectory(src)) {
copyAll(src, dst);
} else {
if (Files.exists(dst)) {
System.out.println(" Destination file already exists, overwriting");
Files.delete(dst);
}
if (Files.exists(dst) && overwrite) {
System.out.println(" Destination file already exists, overwriting");
Files.delete(dst);
Files.copy(src, dst);
} else if (!(Files.exists(dst))) {
Files.copy(src, dst);
} else {
System.out.println(" Destination file already exists, aborting copy");
}
}
} catch (IOException e) {
Expand All @@ -310,7 +304,7 @@ private static Path copyToMavenLocal(String repo, String artifactId, String vers
Files.deleteIfExists(Paths.get(dstDir, jar));
Files.copy(new URL(jarPath).openStream(), Paths.get(dstDir, jar));

String pom = String.format("%s-%s.pom", artifactId, version);
String pom = String.format("%s-%s.pom", artifactId, version);
String pomPath = remoteDir + '/' + pom;
Files.deleteIfExists(Paths.get(dstDir, pom));
Files.copy(new URL(pomPath).openStream(), Paths.get(dstDir, pom));
Expand Down

0 comments on commit 285f65e

Please sign in to comment.