diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2017-12-05 10:37:26 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2017-12-06 09:34:07 +0900 |
commit | df3a7c32a41699b42b052ef9f62b1725928387b1 (patch) | |
tree | 18fe6ed3d4bba03c5dddcc0e07c0d346d0fbe640 /org.eclipse.jgit/src/org/eclipse/jgit | |
parent | 26d78902f8843f24556ba152a38b5f89b21af107 (diff) | |
download | jgit-df3a7c32a41699b42b052ef9f62b1725928387b1.tar.gz jgit-df3a7c32a41699b42b052ef9f62b1725928387b1.zip |
ConfigTest: Move pathToString to FileUtils
ConfigTest#pathToString is not visible to FileBasedConfigTest when
bulding with bazel.
Move it to FileUtils rather than messing about with the bazel build
rules to make it visible.
Change-Id: Idcfd4822699dac9dc4a426088a929a9cd31bf53f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java | 14 |
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; + } } |