File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 11
11
(log-message " Using default storage (" stormroot " )" )
12
12
(reify INimbusStorage
13
13
(^InputStream open [this, ^String path]
14
- (FileInputStream. (str stormroot path)))
14
+ (FileInputStream. (join-paths stormroot path)))
15
15
16
16
(^OutputStream create [this, ^String path]
17
- (FileOutputStream. (str stormroot path)))
17
+ (FileOutputStream. (join-paths stormroot path)))
18
18
19
19
(^List list [this, ^String path]
20
- (seq (.list (File. (str stormroot path)))))
20
+ (seq (.list (File. (join-paths stormroot path)))))
21
21
22
22
(^void delete [this, ^String path]
23
- (let [full-path (str stormroot path)]
23
+ (let [full-path (join-paths stormroot path)]
24
24
(when (exists-file? full-path)
25
25
(FileUtils/forceDelete (File. full-path)))))
26
26
27
27
(^void mkdirs [this, ^String path]
28
- (FileUtils/forceMkdir (File. (str stormroot path))))
28
+ (FileUtils/forceMkdir (File. (join-paths stormroot path))))
29
29
30
30
(^boolean isSupportDistributed [this]
31
31
false ))))
Original file line number Diff line number Diff line change 813
813
(let [klass (if (string? klass) (Class/forName klass) klass)]
814
814
(.newInstance klass)
815
815
))
816
+
817
+ (defn join-paths [^String left ^String right]
818
+ (let [l-slash (= \/ (last left))
819
+ r-slash (= \/ (first right))]
820
+ (if (and l-slash r-slash)
821
+ (let [right (.substring right 1 )]
822
+ (str left right))
823
+ (if-not (or l-slash r-slash)
824
+ (str left " /" right)
825
+ (str left right)))))
826
+
You can’t perform that action at this time.
0 commit comments