[Mono-dev] Mono.Unix - UnixDirectoryInfo.IsSymbolyicLink question

Paddy Joy patrick.joy2 at mail.dcu.ie
Mon Oct 3 06:50:22 EDT 2005


Hi,

Hope someone can help me out with this little problem I'm having.

I have a directory /home/paddy/test which contains one sub-directory and 
one symbolic link:

[root at localhost test]# ls -lh
total 12K
drwxr-xr-x  2 root root 4.0K Oct  3 20:38 directory
lrwxrwxrwx  1 root root    4 Oct  3 20:39 SYMLINK -> /tmp
-rw-r--r--  1 root root  535 Oct  3 20:41 test.cs
-rwxr-xr-x  1 root root 3.5K Oct  3 20:41 test.exe
[root at localhost test]#


When I run the following code:


using System;
using System.Data;
using System.IO;
using Mono.Unix;

namespace test
{
        class test
        {
                static void Main(string[] args)
                {
                        UnixDirectoryInfo test1 = new 
UnixDirectoryInfo("/home/paddy/test/directory");

                        Console.WriteLine(test1.FullName);
                        Console.WriteLine(test1.IsSymbolicLink);

                        UnixDirectoryInfo test2 = new 
UnixDirectoryInfo("/home/paddy/test/SYMLINK");

                        Console.WriteLine(test2.FullName);
                        Console.WriteLine(test2.IsSymbolicLink);
                }
        }
}

I get the output:

/home/paddy/test/directory
False
/home/paddy/test/SYMLINK
False


Should I get True for the symbolic link /home/paddy/test/SYMLINK? Am I 
misunderstanding the meaning of the property IsSymbolicLink or is it 
just my dodgy code?

Paddy




More information about the Mono-devel-list mailing list