File tree Expand file tree Collapse file tree 2 files changed +7
-28
lines changed
java-src/io/github/erdos/stencil/impl Expand file tree Collapse file tree 2 files changed +7
-28
lines changed Original file line number Diff line number Diff line change 22
33import java .io .File ;
44import java .io .IOException ;
5- import java .nio .file .FileSystems ;
6- import java .nio .file .Path ;
75import java .util .UUID ;
8- import java .util .regex .Pattern ;
96
107import static java .lang .System .getProperty ;
118
@@ -101,29 +98,6 @@ public static void forceDelete(final File file) {
10198 file .delete ();
10299 }
103100
104- /**
105- * Returns a string representation of path with unix separators ("/") instead of the
106- * system-dependent separators (which is backslash on Windows).
107- *
108- * @param path not null path object
109- * @return string of path with slash separators
110- * @throws IllegalArgumentException if path is null
111- */
112- public static String toUnixSeparatedString (Path path ) {
113- if (path == null ) {
114- throw new IllegalArgumentException ("Path must not be null!" );
115- } else {
116- final String separator = FileSystems .getDefault ().getSeparator ();
117- if (separator .equals ("/" )) {
118- // on unix systems
119- return path .toString ();
120- } else {
121- // on Windows systems we replace backslash with slashes
122- return path .toString ().replaceAll (Pattern .quote (separator ), "/" );
123- }
124- }
125- }
126-
127101 private static <T > T requireNonNullElse (T first , T second ) {
128102 return first == null ? second : first ;
129103 }
Original file line number Diff line number Diff line change 1010(defn directory? [^File file]
1111 (.isDirectory file))
1212
13- (defn unix-path ^String [^File f]
14- (some-> f .toPath FileHelper/toUnixSeparatedString))
13+ (defn unix-path
14+ " Returns a string representation of path with unix separators ('/')
15+ instead of the system-dependent separators (which is backslash on Windows)."
16+ ^String [^File f]
17+ (when f
18+ (let [path (.toPath f)]
19+ (.replace (str path) (.getSeparator (.getFileSystem path)) " /" ))))
1520
1621(defn parent-file ^File [^File f]
1722 (.getParentFile f))
You can’t perform that action at this time.
0 commit comments