No idea why but it seems that Windows explorer unable to view symlinked directories that the target is not on the same directory as the source target.
Is there a way to fix it? As it also make win32 applications unable to read the files under the symlinked directory. (I understand Windows equivalent mklink exist, but I need to do it in WSL's ln.)
Thanks a lot.
Sysinfo:
- Windows 10 Pro 2004 Build 19041.264
- (No idea how to check WSL build number)
- WSL2
- Subsystem uname:
Linux PC 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux - Ubuntu:
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.4 LTS Release: 18.04 Codename: bionic
Example:
$ pwd
/mnt/d/symlink_test/innerFolder
$ mkdir source
$ touch source/testfile
$ ls source
testfile
$ ln -s source target
$ ls -l
total 0
drwxrwxrwx 1 user user 4096 Jun 6 10:55 source
lrwxrwxrwx 1 user user 6 Jun 6 10:55 target -> source
Now view the output in Windows explorer:
As you can tell, the target folder is recognizable by Windows Explorer
As well as the file testfile is accessable in Windows Explorer
Counter Example:
$ rm -rf target #Just clean things up
$ ls
source
$ ln -s /mnt/d/symlink_test/innerFolder/source ../upper_target #make a symlink to upper dir, or any directory that is not in the same dir, with the source dir being absolute path
$ ls -l .. #List files on the upper dir
total 0
drwxrwxrwx 1 user user 4096 Jun 6 11:03 innerFolder
lrwxrwxrwx 1 user user 6 Jun 6 11:04 upper_target -> /mnt/d/symlink_test/innerFolder/source
$ ls ../upper_target
testfile
However, but now, if you view it in Windows Explorer, the upper_target will become a single file instead of a folder, like above:
