[Mono-list] Symbolic Links

Carl Edwards cce32 at yahoo.com
Mon Nov 10 00:48:32 EST 2008


Thanks everyone for your comments.

I actually found one of the bit flags in the Attributes property (ReparsePoint) of DirectoryInfo objects seems to work to detect directory symlinks.

http://msdn.microsoft.com/en-us/library/system.io.fileattributes.aspx


/Carl

________________________________
From: Juan C. Olivares <juancri at juancri.com>
To: Chris Howie <cdhowie at gmail.com>
Cc: cce32 <cce32 at yahoo.com>; mono-list at lists.ximian.com
Sent: Sunday, November 9, 2008 9:30:13 PM
Subject: Re: [Mono-list] Symbolic Links

On Mon, Nov 10, 2008 at 1:58 AM, Chris Howie <cdhowie at gmail.com> wrote:

On Wed, Nov 5, 2008 at 6:09 PM, cce32 <cce32 at yahoo.com> wrote:
> Currently I develop in Visual Studio 2008 and run on Linux.
>
> It appears directoryInfo.GetFiles("*", SearchOption.AllDirectories) returns
> a FileInfo instance for both files and symlinks.  In other words I get
> duplicates.
>
> Is there any portable way to determine if a file is a symlink?  Or to ignore
> symlinks with GetFiles?

Since Windows doesn't have any notion of a symlink, it's not likely
that there will be any such mechanism in the MS runtime. 

Actually, there are symlinks on NTFS:
http://en.wikipedia.org/wiki/NTFS_symbolic_link

But they are not popular :)
 
On
Linux/Unix systems though, you can just use Mono.Posix to make this
determination.  I believe Mono.Posix is released as MIT/X11 so you
could distribute it with your app and its methods will probably just
throw exceptions on Windows.

--
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers

_______________________________________________
Mono-list maillist  -  Mono-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


More information about the Mono-list mailing list