Permalink
Browse files

fix source-location-for-frame for paths with underscore

  • Loading branch information...
1 parent d0019d5 commit a32a5c20cce8a7eb9bdf64e1a0803dd4e31022b8 @hugoduncan hugoduncan committed Mar 30, 2010
Showing with 8 additions and 4 deletions.
  1. +8 −4 src/swank/commands/basic.clj
@@ -304,20 +304,24 @@ that symbols accessible in the current namespace go first."
(defn- namespace-to-path [ns]
(let [#^String ns-str (name (ns-name ns))
last-dot-index (.lastIndexOf ns-str ".")]
- (if (< 0 last-dot-index)
+ (if (pos? last-dot-index)
(-> (.substring ns-str 0 last-dot-index)
(.replace \- \_)
(.replace \. \/)))))
+(defn- classname-to-path [class-name]
+ (namespace-to-path
+ (symbol (.replace class-name \_ \-))))
+
(defn source-location-for-frame [#^StackTraceElement frame]
(let [line (.getLineNumber frame)
filename (if (.. frame getFileName (endsWith ".java"))
(.. frame getClassName (replace \. \/)
(substring 0 (.lastIndexOf (.getClassName frame) "."))
(concat (str File/separator (.getFileName frame))))
- (let [ns-path (namespace-to-path
- (symbol ((re-find #"(.*?)\$"
- (.getClassName frame)) 1)))]
+ (let [ns-path (classname-to-path
+ ((re-find #"(.*?)\$"
+ (.getClassName frame)) 1))]
(if ns-path
(str ns-path File/separator (.getFileName frame))
(.getFileName frame))))

0 comments on commit a32a5c2

Please sign in to comment.