Fix UnionPath#4
Conversation
…ivizing absolute union paths.
…dler into main � Conflicts: � src/main/java/cpw/mods/niofs/union/UnionPath.java
|
Noticed that other methods (like |
|
I've been meaning to get around to reviewing this. But haven't had the time to sit down and read the NIO specs on what these functions should actually return. |
…t is pasing test now however better testing for the UnionPath methods is required.
|
Should be done now, however it breaks stuff when actually using it together with modlauncher. By that I also noticed that |
…Path#getFileName return an empty string for the empty absolute path.
|
I made it work without changes in modlauncher or forge. Should be ready for review now. |
|
Sorry havent gotten around to testing this. |
|
For what should I add unit tests? I think for the methods in |
|
My bad, I must of been looking at a single commit view and not the full changes. It looked like you skipped the unit tests entirely. |
|
Does this interact with #18 at all? |
|
I've been looking through the code and they shouldn't clash. Just in case, I just tried merging both PRs locally and all tests pass. |
Currently
UnionPath#relativizegives wrong results for absolute paths as a simple test program shows:which gives
where you see the intended behavior in the top line and the behavior with union path in the second line.
This is because when creating a subpath in
relativize,poffis not added to the start index, so the resulting path will always have one element more than it should because of the empty root component.Another thing I saw is that it is valid to relativize a non-absolute path with an absolute path which should not be allowed. This is not addressed by the pull request for now because I'm not certain whether It can safely be merged or might break existing code somewhere else.