[Mono-dev] Replacement for Mono.Unix.UnixFile.TryReadLink
Jonathan Pryor
jonpryor at vt.edu
Wed Jan 11 06:59:47 EST 2006
On Tue, 2006-01-10 at 05:47 -0700, Buderya Roshan wrote:
> In Mono 1.1.13 The class Mono.Unix.UnixFile is marked obsolete.
UnixFile doesn't exist in 1.1.13. It was in 1.1.12.
> This
> class used to provide a static method TryReadLink to get the target of a
> symbolic link. Is the class Mono.Unix.UnixSymbolicLinkInfo the
> replacement?
Yes.
> The behaviour of TryReadLink and
> UnixSymbolicLinkInfo.ContentsPath seems to be the same. Wanted to
> counter check if this is indeed the case.
Those aren't direct equivalents. UnixSymbolicLinkInfo.ContentsPath is
equivalent to UnixFile.ReadLink() -- it will throw an exception if there
was an error reading the link. UnixFile.TryReadLink() can be simulated:
// 1.1.12 Code:
string target = UnixFile.TryReadLink ("sym-link");
// 1.1.13 Code:
UnixSymbolicLinkInfo symlink = new UnixSymbolicLinkInfo ("sym-link");
string target = symlink.HasContents ? symlink.ContentsPath :
null;
- Jon
More information about the Mono-devel-list
mailing list