With pwsh on macOS and Linux, the LinkType property on IO.DirectoryInfo IO.FileInfo objects have a value of SymbolicLink when creating objects to non-existent directories or files. In Windows PowerShell and pwsh on Windows 10, LinkType is null. I would expect pwsh on macOS/Linux to behave the same.
Steps to reproduce
pwsh 7.1.3 on macOS and Linux
[IO.DirectoryInfo]::new('doesnotexist') | Format-List
[IO.FileInfo]::new('doesnotexist') | Format-List
Expected behavior
pwsh 7.1.3 on Windows 10
> [IO.DirectoryInfo]::new('doesnotexist') | Format-List
Name : doesnotexist
CreationTime : 12/31/1600 4:00:00 PM
LastWriteTime : 12/31/1600 4:00:00 PM
LastAccessTime : 12/31/1600 4:00:00 PM
Mode : larhs
LinkType :
Target : doesnotexist
> [IO.FileInfo]::new('doesnotexist') | Format-List
Name : doesnotexist
Length :
CreationTime : 12/31/1600 4:00:00 PM
LastWriteTime : 12/31/1600 4:00:00 PM
LastAccessTime : 12/31/1600 4:00:00 PM
Mode : larhs
LinkType :
Target : doesnotexist
Actual behavior
On macOS and Linux, the LinkType property has a value of SymbolicLink, even though the directory/file does not exist.
> [IO.DirectoryInfo]::new('doesnotexist') | Format-List
Name : doesnotexist
CreationTime : 12/31/1600 16:07:00
LastWriteTime : 12/31/1600 16:07:00
LastAccessTime : 12/31/1600 16:07:00
Mode : larhs
LinkType : SymbolicLink
Target : doesnotexist
> [IO.FileInfo]::new('doesnotexist') | Format-List
Name : doesnotexist
Length :
CreationTime : 12/31/1600 16:07:00
LastWriteTime : 12/31/1600 16:07:00
LastAccessTime : 12/31/1600 16:07:00
Mode : larhs
LinkType : SymbolicLink
Target : doesnotexist
Environment data
WSL
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Linux 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Windows 10
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 10.0.19043
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
With pwsh on macOS and Linux, the
LinkTypeproperty onIO.DirectoryInfoIO.FileInfoobjects have a value ofSymbolicLinkwhen creating objects to non-existent directories or files. In Windows PowerShell and pwsh on Windows 10,LinkTypeisnull. I would expect pwsh on macOS/Linux to behave the same.Steps to reproduce
pwsh 7.1.3 on macOS and Linux
Expected behavior
pwsh 7.1.3 on Windows 10
Actual behavior
On macOS and Linux, the
LinkTypeproperty has a value ofSymbolicLink, even though the directory/file does not exist.Environment data
WSL
Windows 10