diff options
author | Andrey Loskutov <loskutov@gmx.de> | 2015-08-16 17:41:22 +0200 |
---|---|---|
committer | Christian Halstrick <christian.halstrick@sap.com> | 2015-08-17 16:06:15 +0200 |
commit | 2e5c7c5db476a00ee89e610824f070471693ab6a (patch) | |
tree | da6ae149dd910c363c2d6a6a4cfd4d4d9570ee0d /org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtil.java | |
parent | 91b1ab90e29883d1fe50eeafd52fcc1dd38a3713 (diff) | |
download | jgit-2e5c7c5db476a00ee89e610824f070471693ab6a.tar.gz jgit-2e5c7c5db476a00ee89e610824f070471693ab6a.zip |
Move createSymLink/readSymLink to FileUtils
Bug: 475070
Change-Id: I258f4bf291e02ef8e6f867b5d71c04ec902b6bcb
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtil.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtil.java | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtil.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtil.java index 109b2df5f2..54b1ae3319 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtil.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtil.java @@ -55,7 +55,6 @@ import java.nio.file.attribute.PosixFileAttributeView; import java.nio.file.attribute.PosixFileAttributes; import java.nio.file.attribute.PosixFilePermission; import java.text.Normalizer; -import java.text.Normalizer.Form; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.util.FS.Attributes; @@ -67,40 +66,6 @@ public class FileUtil { /** * @param path - * @return target path of the symlink - * @throws IOException - */ - public static String readSymlink(File path) throws IOException { - Path nioPath = path.toPath(); - Path target = Files.readSymbolicLink(nioPath); - String targetString = target.toString(); - if (SystemReader.getInstance().isWindows()) - targetString = targetString.replace('\\', '/'); - else if (SystemReader.getInstance().isMacOS()) - targetString = Normalizer.normalize(targetString, Form.NFC); - return targetString; - } - - /** - * @param path - * path of the symlink to be created - * @param target - * target of the symlink to be created - * @throws IOException - */ - public static void createSymLink(File path, String target) - throws IOException { - Path nioPath = path.toPath(); - if (Files.exists(nioPath, LinkOption.NOFOLLOW_LINKS)) - Files.delete(nioPath); - if (SystemReader.getInstance().isWindows()) - target = target.replace('/', '\\'); - Path nioTarget = new File(target).toPath(); - Files.createSymbolicLink(nioPath, nioTarget); - } - - /** - * @param path * @return {@code true} if the passed path is a symlink */ public static boolean isSymlink(File path) { |