[Mono-dev] Replacement for Mono.Unix.UnixFile.TryReadLink

Jonathan Pryor jonpryor at vt.edu
Thu Jan 12 20:33:21 EST 2006


On Thu, 2006-01-12 at 16:40 +0100, Paolo Molaro wrote:
> On 01/11/06 Jonathan Pryor wrote:
> > > >         // 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;
> > > 
> > > Why is the first method obsoleted, though? It's way clearer and likely
> > > faster, too.
> > 
> > Because most of the UnixFile methods were forwards to UnixFileInfo
> > members, so I removed it in the interest of simplification &
> > documentation.
> 
> I'd say the simplification part didn't really work that well since now
> 3 method calls + conditional execution is required to do what a single
> call accomplished before.

I've added UnixPath.TryReadLink() and UnixPath.ReadLink() methods to
trunk, but not the 1.1.13 branch.  These have the same semantics as the
previous UnixFile methods.

 - Jon





More information about the Mono-devel-list mailing list