allenai / AMPT

Aquatic Mammal Photogrammetry Tool
Apache License 2.0
3 stars 0 forks source link

Always use slash (/) for resource path separator. #107

Closed APatrickJ closed 2 years ago

APatrickJ commented 2 years ago

This fixes a Windows-specific bug in which the system file separator (\) was being used. According to the Java documentation, the path separator should always be a forward slash.

Reference: https://docs.oracle.com/javase/8/docs/technotes/guides/lang/resources.html

Fixes #105

APatrickJ commented 2 years ago

This is a frustrating fix, since the vendor-provided library should return valid paths. :/

I understand where the frustration comes from. Arguably Paths was being used incorrectly here, as it can't know that it's being used to get a resource path from inside a jar file where the normal OS-dependent filesystem rules don't apply, so it's up to the caller to use it in the appropriate context. Kind of an insidious bug, though.

I think I wrote the original bug so I can be a little tough on myself :-)