mirror of
https://github.com/janet-lang/janet
synced 2024-12-26 00:10:27 +00:00
Update create-dirs to work on windows style paths.
This commit is contained in:
parent
fce1529bf2
commit
8ce092da68
16
auxbin/jpm
16
auxbin/jpm
@ -177,14 +177,6 @@
|
||||
microsoft.com"))
|
||||
(do)))
|
||||
|
||||
(defn create-dirs
|
||||
"Create all directories needed for a file (mkdir -p)."
|
||||
[dest]
|
||||
(def segs (string/split "/" dest))
|
||||
(for i 1 (length segs)
|
||||
(def path (string/join (slice segs 0 i) "/"))
|
||||
(unless (empty? path) (os/mkdir path))))
|
||||
|
||||
#
|
||||
# Importing a file
|
||||
#
|
||||
@ -244,6 +236,14 @@
|
||||
"split paths on / and \\."
|
||||
(peg/compile ~(any (* '(any (if-not (set `\/`) 1)) (+ (set `\/`) -1)))))
|
||||
|
||||
(defn create-dirs
|
||||
"Create all directories needed for a file (mkdir -p)."
|
||||
[dest]
|
||||
(def segs (peg/match path-splitter dest))
|
||||
(for i 1 (length segs)
|
||||
(def path (string/join (slice segs 0 i) sep))
|
||||
(unless (empty? path) (os/mkdir path))))
|
||||
|
||||
(def- filepath-replacer
|
||||
"Convert url with potential bad characters into a file path element."
|
||||
(peg/compile ~(% (any (+ (/ '(set "<>:\"/\\|?*") "_") '1)))))
|
||||
|
Loading…
Reference in New Issue
Block a user