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 for Windwos paths #1

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
34 changes: 34 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build Java Project

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'

- name: Build with Maven
run: |
cd cwaf-ontology
mvn clean package

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: compiled-jar
path: cwaf-ontology/target/*.jar
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