diff --git a/src/envs/config/PathConfig.java b/src/envs/config/PathConfig.java index ef3f572..fc7afa7 100644 --- a/src/envs/config/PathConfig.java +++ b/src/envs/config/PathConfig.java @@ -1,6 +1,7 @@ package envs.config; import java.io.File; +import java.nio.file.Paths; import java.util.Arrays; import envs.toolkit.ANSIHandler; @@ -12,6 +13,7 @@ public class PathConfig { /* Environment */ + public static final String CurrPath = Paths.get("").toAbsolutePath().toString() + File.separator; public static final String JarPath = new File(UFCGMainPipeline.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParent() + File.separator; public static String EnvironmentPath = ""; public static boolean EnvironmentPathSet = false; diff --git a/src/module/DownloadModule.java b/src/module/DownloadModule.java index f0e7e2e..d111bb7 100644 --- a/src/module/DownloadModule.java +++ b/src/module/DownloadModule.java @@ -154,6 +154,8 @@ private void printManual() { private void checkStatus(){ boolean ping = internetConnection(); if(PathConfig.EnvironmentPathSet && !dirGiven) dir = PathConfig.EnvironmentPath; + String sampleDir = dir; + if(!dirGiven) sampleDir = PathConfig.CurrPath; System.out.println(ANSIHandler.wrapper(" System status", 'Y')); System.out.println(ANSIHandler.wrapper(" OS : " + GenericConfig.OS, 'x')); @@ -169,7 +171,7 @@ private void checkStatus(){ ANSIHandler.wrapper("OK", 'G') : ANSIHandler.wrapper("NO", 'R'))); System.out.println(ANSIHandler.wrapper(" busco ", 'x') + (new File(dir + "config/seq/busco/100957at4751.fa").exists() ? ANSIHandler.wrapper("OK", 'G') : ANSIHandler.wrapper("NO", 'R'))); - System.out.println(ANSIHandler.wrapper(" sample ", 'x') + (new File(dir + "sample/meta_full.tsv").exists() ? + System.out.println(ANSIHandler.wrapper(" sample ", 'x') + (new File(sampleDir + "sample/meta_full.tsv").exists() ? ANSIHandler.wrapper("OK", 'G') : ANSIHandler.wrapper("NO", 'R'))); System.out.println(); @@ -288,6 +290,10 @@ private void downloadBusco(){ Prompt.print("Download success : target " + ANSIHandler.wrapper("busco", 'G')); } private void downloadSample(){ + if(!dirGiven) { + dir = PathConfig.CurrPath; + } + // download payload Prompt.print("Downloading sample package on " + ANSIHandler.wrapper(dir + "sample.tar.gz", 'y') + " ..."); Shell.exec(String.format("wget -q -O %ssample.tar.gz https://ufcg.steineggerlab.workers.dev/payload/sample.tar.gz", dir));