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

FilePathUtils.joinZipPathSegments error on windows #1609

Merged
merged 6 commits into from
Mar 11, 2024

Conversation

TwoOfTwelve
Copy link
Contributor

@TwoOfTwelve TwoOfTwelve commented Feb 24, 2024

The file creation now uses the path api instead of manual concatenation. I cannot test it on windows. So it would be great if someone could confirm it also works on windows.

Fixes #1592

@TwoOfTwelve TwoOfTwelve requested review from Kr0nox and tsaglam and removed request for Kr0nox February 24, 2024 16:50
@Kr0nox
Copy link
Member

Kr0nox commented Feb 24, 2024

This does not generate the expected report with the single submission files, so just a folder with files.
Input folder:

Folder
└Sub1.java
└Sub2.java

We would expect the report zip be look like this:

files
 └Sub1.java (This is a folder)
 |  └ Sub1.java
 └Sub2.java (This is a folder)
 |  └ Sub2.java
Json Files

But the zip looks like this:

files
 └Sub1.java (This is a file)
 └Sub2.java (This is a file)
Json Files

@TwoOfTwelve
Copy link
Contributor Author

I think this is again an issue with submissions without sub-directories. I will look into it tomorrow.

@Kr0nox
Copy link
Member

Kr0nox commented Feb 25, 2024

Also fixes #1610

I would suggest moving this to a diferent PR, since it is very independent of the other issue

We should also disguss how we want the file names to actually look like

@TwoOfTwelve
Copy link
Contributor Author

I agree, but since the solutions depend on one another I would only create the second PR after this one has been merged.

Copy link
Member

@Kr0nox Kr0nox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for some JDoc this looks good.

Tested on windows

@tsaglam tsaglam added bug Issue/PR that involves a bug minor Minor issue/feature/contribution/change labels Feb 26, 2024
@TwoOfTwelve TwoOfTwelve requested a review from Kr0nox February 27, 2024 14:00
Copy link
Member

@tsaglam tsaglam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just three minor things to discuss.

core/src/main/java/de/jplag/reporting/FilePathUtil.java Outdated Show resolved Hide resolved
rightStripped = rightStripped.substring(1);
public static Path forceRelativePath(Path path) {
if (path.isAbsolute()) {
return Path.of("/").relativize(path);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the explicit backslash intentional? Is it another concept or why is the constant with the same value not used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The slash here is intentional, as we simply need a path that represents a root. It does not matter which, but in my opinion a UNIX root is the simplest. It does not use the constant, because the divider for zip paths is something else than a root. If you prefer it, I can change it to use the constant or a new one instead.

core/src/main/java/de/jplag/reporting/FilePathUtil.java Outdated Show resolved Hide resolved
Copy link
Member

@Kr0nox Kr0nox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on windows. Works with:

Copy link

sonarqubecloud bot commented Mar 3, 2024

@tsaglam tsaglam merged commit 20aa1aa into develop Mar 11, 2024
9 checks passed
@tsaglam tsaglam deleted the feature/join-zip-path-segments branch March 11, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue/PR that involves a bug minor Minor issue/feature/contribution/change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants