alexdelorenzo / aiopath

📁 Asynchronous pathlib for Python
https://alexdelorenzo.dev
GNU Lesser General Public License v3.0
162 stars 6 forks source link

Windows readlink() Behavior Differences #20

Open The-Randalorian opened 2 years ago

The-Randalorian commented 2 years ago

When reading an NTFS file system on windows, a program may encounter junction points, which are similar to symbolic links, but a bit different, see this GeeksforGeeks page https://www.geeksforgeeks.org/ntfs-junction-points/. The readlink functions from pathlib.Path and aiopath.AsyncPath act slightly differently when encountering junction points. When calling Path.readlink() on a junction point, the path the junction point points to is returned. AsyncPath.readlink() instead raises a TypeError.

For testing purposes, you can use the junction point C:\Users\[YOUR USERNAME]\AppData\Local\Application Data\ which points to C:\Users\[YOUR USERNAME]\AppData\Local\.