From 739cca10fd22d8e73454c38c2550d4e9eabe3bb4 Mon Sep 17 00:00:00 2001 From: carlosuc3m <100329787@alumnos.uc3m.es> Date: Tue, 27 Sep 2022 15:19:19 +0200 Subject: [PATCH] adapt to changes in versions download --- .../DeepLearningVersionDownloader.java | 20 ++++++++++--------- .../DeepLearningDownloader.java | 1 + 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/bioimageanalysis/icy/deeplearning/versionmanager/downloading/DeepLearningVersionDownloader.java b/src/main/java/org/bioimageanalysis/icy/deeplearning/versionmanager/downloading/DeepLearningVersionDownloader.java index 325d335..22a3475 100644 --- a/src/main/java/org/bioimageanalysis/icy/deeplearning/versionmanager/downloading/DeepLearningVersionDownloader.java +++ b/src/main/java/org/bioimageanalysis/icy/deeplearning/versionmanager/downloading/DeepLearningVersionDownloader.java @@ -24,6 +24,7 @@ import java.util.stream.IntStream; import org.bioimageanalysis.icy.deeplearning.util.StreamUtils; import org.bioimageanalysis.icy.deeplearning.versionmanagement.DeepLearningVersion; +import org.bioimageanalysis.icy.deeplearning.versionmanagement.InstalledDeepLearningVersions; import com.google.common.util.concurrent.AtomicDouble; @@ -39,7 +40,7 @@ public class DeepLearningVersionDownloader /** * The path where Deep Learning libraries are downloaded. */ - private static Path downloadsPath = Paths.get("engines").toAbsolutePath(); + private static Path downloadsPath = Paths.get(InstalledDeepLearningVersions.getInstalledVersionsDir()).toAbsolutePath(); /** * Checks if the target Downloaded version is already downloaded locally. @@ -92,10 +93,18 @@ public class DeepLearningVersionDownloader * Get the path where all the Deep Learning engines are stored * @return the path where all the Deep Learning engines are stored */ - public static String getEnginesFolderPath() { + public static String getEnginesFolderPathAsString() { return downloadsPath.toString(); } + /** + * Get the path where all the Deep Learning engines are stored + * @return the path where all the Deep Learning engines are stored + */ + public static Path getEnginesFolderPathAsPath() { + return downloadsPath; + } + /** * Get String array of engine folders in the engines folder * @return string array with folder names inside the engines folder @@ -304,12 +313,5 @@ public class DeepLearningVersionDownloader }).collect(Collectors.toList()); return pathList; } - - public static void setEnginesDirectory(String dir) throws IOException { - if (!(new File(dir).isDirectory())) - throw new IOException("The engines directory must correspond to an already existing folder. " - + "The provided path is not valid: " + dir); - downloadsPath = Paths.get(dir); - } } diff --git a/src/main/java/plugins/danyfel80/deeplearningdownloader/DeepLearningDownloader.java b/src/main/java/plugins/danyfel80/deeplearningdownloader/DeepLearningDownloader.java index 37b42fd..d280521 100644 --- a/src/main/java/plugins/danyfel80/deeplearningdownloader/DeepLearningDownloader.java +++ b/src/main/java/plugins/danyfel80/deeplearningdownloader/DeepLearningDownloader.java @@ -38,6 +38,7 @@ public class DeepLearningDownloader extends Plugin implements PluginLibrary throws IOException { Objects.requireNonNull(targetVersion, "Null Deep Learning version"); + targetVersion.setEnginesDir(); try { -- GitLab