Skip to content

Commit

Permalink
rename to less generic: path -> outdir
Browse files Browse the repository at this point in the history
  • Loading branch information
maxulysse committed Oct 7, 2024
1 parent 544bf22 commit 9a3dec8
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/main/java/nf_core/nf/test/utils/Methods.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,31 +51,32 @@ public static List getAllFilesFromDir(String path) throws IOException {
}

// wrapper functions for getAllFilesFromDir with named options
public static List getAllFilesFromDir(LinkedHashMap<String, Object> options, String path) throws IOException {
if (path == null || path.isEmpty()) {
throw new IllegalArgumentException("The 'path' parameter is required.");
public static List getAllFilesFromDir(LinkedHashMap<String, Object> options, String outdir) throws IOException {
if (outdir == null || outdir.isEmpty()) {
throw new IllegalArgumentException("The 'outdir' parameter is required.");
}
// Check if path exists
Path dirPath = Paths.get(path);
Path dirPath = Paths.get(outdir);
if (!Files.exists(dirPath)) {
throw new IllegalArgumentException("The specified path does not exist: " + path);
throw new IllegalArgumentException("The specified path does not exist: " + outdir);
}

// Check if it's a directory
if (!Files.isDirectory(dirPath)) {
throw new IllegalArgumentException("The specified path is not a directory: " + path);
throw new IllegalArgumentException("The specified path is not a directory: " + outdir);
}

// Extract optional parameters from the map (use defaults if not provided)
Boolean includeDir = (Boolean) options.getOrDefault("includeDir", true);
List<String> ignoreGlobs = (List<String>) options.getOrDefault("ignore", new ArrayList<String>());
String ignoreFilePath = (String) options.get("ignoreFile");
Boolean relative = (Boolean) options.getOrDefault("relative", false);
List<String> includeGlobs = (List<String>) options.getOrDefault("include", new ArrayList<String>());

List<File> files = getAllFilesFromDir(path, includeDir, ignoreGlobs, ignoreFilePath);
List<File> files = getAllFilesFromDir(outdir, includeDir, ignoreGlobs, ignoreFilePath);

if (relative) {
return getRelativePath(files, path);
return getRelativePath(files, outdir);
} else {
return files;
}
Expand Down

0 comments on commit 9a3dec8

Please sign in to comment.