Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Files.isSymbolicLink(aPath)
- DIR /S /A:L
- BasicFileAttributes attr = Files.readAttributes(path, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS);
- boolean isReparsePoint = false;
- if (DosFileAttributes.class.isInstance(attr))
- try {
- Method m = attr.getClass().getDeclaredMethod("isReparsePoint");
- m.setAccessible(true);
- isReparsePoint = (boolean) m.invoke(attr);
- } catch (Exception e) {
- // just gave it a try
- }
- /**
- * returns true if the Path is a Windows Junction
- */
- private static boolean isJunction(Path p) {
- boolean isJunction = false;
- try {
- isJunction = (p.compareTo(p.toRealPath()) != 0);
- } catch (IOException e) {
- e.printStackTrace(); // TODO: handleMeProperly
- }
- return isJunction;
- }
- BasicFileAttributes attrs = Files.readAttributes(aPath, BasicFileAttributes.class);
- boolean isJunction = isWindows && attrs.isOther();
Add Comment
Please, Sign In to add comment