aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java
index 98c991ae25..2b6c8c94df 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java
@@ -869,4 +869,18 @@ public class FileUtils {
}
}
+ /**
+ * Convert a path to String, replacing separators as necessary.
+ *
+ * @param file
+ * @return file's path as a String
+ * @since 4.10
+ */
+ public static String pathToString(File file) {
+ final String path = file.getPath();
+ if (SystemReader.getInstance().isWindows()) {
+ return path.replace('\\', '/');
+ }
+ return path;
+ }
}