jdk/src/windows/classes/sun/nio/fs/WindowsPath.java
changeset 3326 31a5302fe6d4
parent 3065 452aaa2899fc
child 5506 202f599c92aa
equal deleted inserted replaced
3325:0e7d9c6c9994 3326:31a5302fe6d4
  1175             throw new IOException("Cannot create symbolic link to working directory relative target");
  1175             throw new IOException("Cannot create symbolic link to working directory relative target");
  1176         }
  1176         }
  1177 
  1177 
  1178         /*
  1178         /*
  1179          * Windows treates symbolic links to directories differently than it
  1179          * Windows treates symbolic links to directories differently than it
  1180          * does to other file types. For that reason we check if the exists and
  1180          * does to other file types. For that reason we need to check if the
  1181          * is a directory.
  1181          * target is a directory (or a directory junction).
  1182          */
  1182          */
       
  1183         WindowsPath resolvedTarget;
       
  1184         if (target.type == WindowsPathType.RELATIVE) {
       
  1185             WindowsPath parent = getParent();
       
  1186             resolvedTarget = (parent == null) ? target : parent.resolve(target);
       
  1187         } else {
       
  1188             resolvedTarget = resolve(target);
       
  1189         }
  1183         int flags = 0;
  1190         int flags = 0;
  1184         WindowsPath resolvedTarget =
       
  1185             WindowsPath.createFromNormalizedPath(getFileSystem(), resolve(target).path);
       
  1186         try {
  1191         try {
  1187             if (WindowsFileAttributes.get(resolvedTarget, true).isDirectory())
  1192             WindowsFileAttributes wattrs = WindowsFileAttributes.get(resolvedTarget, false);
       
  1193             if (wattrs.isDirectory() || wattrs.isDirectoryLink())
  1188                 flags |= SYMBOLIC_LINK_FLAG_DIRECTORY;
  1194                 flags |= SYMBOLIC_LINK_FLAG_DIRECTORY;
  1189         } catch (WindowsException x) {
  1195         } catch (WindowsException x) {
  1190             // unable to access target so assume target is not a directory
  1196             // unable to access target so assume target is not a directory
  1191         }
  1197         }
  1192 
  1198