Guest User

Untitled

a guest
Jan 16th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. Files.isSymbolicLink(aPath)
  2.  
  3. DIR /S /A:L
  4.  
  5. BasicFileAttributes attr = Files.readAttributes(path, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS);
  6.  
  7. boolean isReparsePoint = false;
  8. if (DosFileAttributes.class.isInstance(attr))
  9. try {
  10. Method m = attr.getClass().getDeclaredMethod("isReparsePoint");
  11. m.setAccessible(true);
  12. isReparsePoint = (boolean) m.invoke(attr);
  13. } catch (Exception e) {
  14. // just gave it a try
  15. }
  16.  
  17. /**
  18. * returns true if the Path is a Windows Junction
  19. */
  20. private static boolean isJunction(Path p) {
  21. boolean isJunction = false;
  22. try {
  23. isJunction = (p.compareTo(p.toRealPath()) != 0);
  24. } catch (IOException e) {
  25. e.printStackTrace(); // TODO: handleMeProperly
  26. }
  27. return isJunction;
  28. }
  29.  
  30. BasicFileAttributes attrs = Files.readAttributes(aPath, BasicFileAttributes.class);
  31. boolean isJunction = isWindows && attrs.isOther();
Add Comment
Please, Sign In to add comment