Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch win #3

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion cwaf-ontology/src/main/java/be/uclouvain/service/Parser.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package be.uclouvain.service;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
Expand Down Expand Up @@ -358,7 +359,18 @@ public static void main(String[] args) {

//ChatGPT - Code Snippet
public static List<Path> expandPath(String pattern) throws IOException {
Path basePath = Paths.get(pattern).getParent();
//Path basePath = Paths.get(pattern).getParent();

// Extract the directory portion from the pattern
int lastSeparatorIndex = pattern.lastIndexOf(File.separator);

// Determine the base path based on the last occurrence of the separator
Path basePath;
if (lastSeparatorIndex != -1) {
basePath = Paths.get(pattern.substring(0, lastSeparatorIndex));
} else {
basePath = Paths.get(".");
}
String globPattern = "glob:" + pattern;

if (basePath == null) {
Expand Down