Skip to content

make! fails on windows (URISyntaxException) #255

@fezboy

Description

@fezboy

Hey all, trying to run clay (natively) on windows I'm getting the following error:

(clay/make! {:source-path "src/mini/playground.clj" :base-target-path "test"})
; Execution error (URISyntaxException) at java.net.URI$Parser/fail (URI.java:2974).
; Illegal character in path at index 4: test\src.mini.playground_files/html-default0.js
                                            ^

The culprit is the \ indicated. Digging into it, it looks like hiccup takes this string (full-target-path and tries to turn it into a URI using Java.net.URI, which doesn't support windows style file paths (it wants the input to be a proper URI). (see hiccup.util/to-uri)

The string was created in scicloj.clay.v2.make/spec->full-target-path using babashka.fs/path. I was able to make it work by passing the path through fs/unixify, but it seems hacky, and is likely missing the same issue with other uses of fs/path.

--- a/src/scicloj/clay/v2/make.clj
+++ b/src/scicloj/clay/v2/make.clj
@@ -101,7 +101,7 @@
                                                  (and "-revealjs"))
                                          ".html"))
                  flatten-targets (str/replace #"[\\/]+" ".")
-                 true (#(fs/path base-target-path %))))))
+                 true (#(fs/unixify (fs/path base-target-path %)))))))

     :else

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions