You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Miłosz S (Jira)" <ji...@apache.org> on 2021/02/26 16:18:00 UTC
[jira] [Commented] (IO-295) FileUtils.isSymlinks misses symlink
folders on Windows
[ https://issues.apache.org/jira/browse/IO-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17291737#comment-17291737 ]
Miłosz S commented on IO-295:
-----------------------------
Please also note that on Windows there are symlinks AND "junctions":
[https://docs.microsoft.com/en-us/windows/win32/fileio/hard-links-and-junctions]
And {{java.nio.file.Files.isSymbolicLink()}} is not detecting junctions. To detect them, you should check for file attributes of given {{Path}}:
{code:java}
Path p = Paths.get("C:\\some\\path")
BasicFileAttributes attrs = Files.readAttributes(p, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS);
boolean isJunction = attrs.isDirectory() && attrs.isOther();
{code}
^Above solution suggested [here on JDK JIRA|https://bugs.openjdk.java.net/browse/JDK-8031083?focusedCommentId=13444574&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-13444574]
> FileUtils.isSymlinks misses symlink folders on Windows
> ------------------------------------------------------
>
> Key: IO-295
> URL: https://issues.apache.org/jira/browse/IO-295
> Project: Commons IO
> Issue Type: Bug
> Affects Versions: 2.1
> Environment: Windows 7 64 bit, Oracle Java 7
> Reporter: Ron Gross
> Priority: Major
> Attachments: IO-295-1.patch, IO-295.patch
>
>
> I created a symlink folder via mklink.
> Then, while debugging, I noticed that FileUtils.isSymlink() returns false on this directory, while Java 7's Files.isSymbolicLink() returns true.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)