<< Back to previous view

[CLASSPATH-4] clojure.java.classpath/classpath gives bogus %20 paths when there are spaces in the pathnames Created: 12/Dec/12  Updated: 18/Jan/13  Resolved: 18/Jan/13

Status: Closed
Project: java.classpath
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Tim McCormack Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File 0001-CLASSPATH-4-Use-io-as-file-instead-of-treating-URL-a.patch    

 Description   

Reproduce: In a directory called "foo bar", create this project file:

(defproject test-proj "1.0.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.4.0"]
                 [org.clojure/java.classpath "0.2.0"]])

In the REPL:

(require '[clojure.java.classpath :as cp])
(cp/classpath)

Expected results:

(... #<File /home/timmc/foo bar/src> ...)

Actual results:

(... #<File /home/timmc/foo%20bar/src> ...)



 Comments   
Comment by Tim McCormack [ 12/Dec/12 11:02 PM ]

This seems to be the result of how loader-classpath handles URL -> File conversion:

#(java.io.File. (.getPath ^java.net.URL %))
Comment by Tim McCormack [ 13/Dec/12 5:39 PM ]

I think using clojure.java.io/as-file would be sufficient to handle this conversion properly.

Comment by Tim McCormack [ 11/Jan/13 3:10 PM ]

Attached patch uses clojure.java.io/as-file to handle URL -> File conversion.

Comment by Stuart Sierra [ 18/Jan/13 8:58 AM ]

applied

Generated at Wed Apr 16 05:30:29 CDT 2014 using JIRA 4.4#649-r158309.