How to follow symbolic links on disk?
AbsoluteFileName
will resolve symbolic links.
Example on my machine:
AbsoluteFileName["/Library/TeX/texbin"]
(* "/usr/local/texlive/2019/bin/x86_64-darwin" *)
After a bit more fiddling around I found FileInformation
, an undocumented function which takes a file name as an argument.
FileInformation[FindFile["myPackage
"]]` returns
{AbsoluteFileName->/absolute/path/to/myPackage.wl,
BlockCount->24,
BlockSize->4096,
ByteCount->8474,
CreationDate->Thu 17 Oct 2019 11:06:04GMT-4.,
Device->16777220,
DirectoryName->$HOME/Library/Mathematica/Applications,
FileAttributes->Missing[NotAvailable],
FileBaseName->myPackage,FileExtension->wl,
FileName->$HOME/Library/Mathematica/Applications/myPackage.wl,
FileType->File,
GID->20,
GroupName->Missing[NotAvailable],
Inode->28731823,
LastAccessDate->Wed 23 Oct 2019 18:16:13GMT-4.,
LastModificationDate->Wed 23 Oct 2019 18:16:10GMT-4.,
LinkCount->1,
OwnerName->Missing[NotAvailable],
RawByteCount->12288,
SetGroupID->False,
SetUserID->False,
Sticky->False,
UID->501,
UnixPermissionsCode->0660,
UnixPermissionsString->-rw-rw----}
where I replaced my home directory with $HOME
and the true readlink
path with /absolute/path/to/myPackage.wl
for privacy. CreationDate
, LastAccessDate
, and LastModificationDate
are DateObject
s, all the left-hand sides of the rules are "strings"
, and the right-hand sides are integers, strings, etc.
SO, what I was looking for was "AbsoluteFileName"/.FileInformation[FindFile["myPackage
"]]`