virgil icon indicating copy to clipboard operation
virgil copied to clipboard

Windows file separators causing URISyntaxException

Open SOberhoff opened this issue 7 years ago • 8 comments

I have a Java file called abc.java located at src/misc/abc.java and src is added to my :java-source-paths. When starting the REPL I receive:

Exception in thread "main" java.lang.IllegalArgumentException: Illegal character in path at index 10: string:///\misc\abc.java, compiling: ...
...
Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 10: string:///\misc\abc.java
	at java.net.URI.create(URI.java:852)
	at virgil.compile$source_object.invokeStatic(compile.clj:33)
	at virgil.compile$source_object.invoke(compile.clj:30)
	at virgil.compile$source__GT_bytecode$fn__1816.invoke(compile.clj:68)```
...
Caused by: java.net.URISyntaxException: Illegal character in path at index 10: string:///\misc\abc.java
	at java.net.URI$Parser.fail(URI.java:2848)
	at java.net.URI$Parser.checkChars(URI.java:3021)
	at java.net.URI$Parser.parseHierarchical(URI.java:3105)
	at java.net.URI$Parser.parse(URI.java:3053)
	at java.net.URI.<init>(URI.java:588)
	at java.net.URI.create(URI.java:850)

The \ appears to be the issue. When I remove Virgil from the plugins the error disappears. I'm running Windows 10 and using Virgil 0.1.6.

SOberhoff avatar Jun 14 '17 18:06 SOberhoff

Okay, I think I'm using a hardcoded backslash when I should be using File/separator. I don't have a Windows box to test this on, would you mind being used as a tester for a potential fix?

ztellman avatar Jun 14 '17 18:06 ztellman

I've pushed a potential fix. Can you clone the repo, run lein install, and try it again?

ztellman avatar Jun 14 '17 18:06 ztellman

Now I have Illegal character in path at index 14: string:///misc\abc.java

SOberhoff avatar Jun 14 '17 19:06 SOberhoff

Oh, I have to take off the third backslash on the prefix, too. Not near a computer, but I'll update once a fix is in place. Thanks for your patience On Wed, Jun 14, 2017 at 12:43 PM SOberhoff [email protected] wrote:

Now I have Illegal character in path at index 14: string:///misc\abc.java

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ztellman/virgil/issues/12#issuecomment-308537419, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB6P9h9PQVBM1QWqj6ACe04jN3jHPNWks5sEDfUgaJpZM4N6RN0 .

ztellman avatar Jun 14 '17 20:06 ztellman

I've pushed the second update, let me know if it does the trick. If not, I'll look into getting some sort of virtual environment I can do my own tests in.

ztellman avatar Jun 15 '17 01:06 ztellman

Now it's saying Illegal character in authority at index 9: string://\misc\abc.java

SOberhoff avatar Jun 15 '17 08:06 SOberhoff

I've messed around with the code myself a little and all Windows issues are solved by replacing every occurrence of File/separator with "/" (lines 33, 34, 43, 44). I don't know whether that raises issues on Linux/Mac.

SOberhoff avatar Jun 15 '17 08:06 SOberhoff

This should be fixed in 0.1.7 and the issue can be closed.

schmir avatar Nov 20 '17 22:11 schmir