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 325d33585116ed496e1a688b8cd6e40b27d09ff5..22a347593160bee6a6c6142929a38d2aa4af716b 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 37b42fd8a6f320442a202153b1d407741d405c60..d28052157f734864c359cff70f20c9f678a076dc 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 {