[Mono-list] Is it the intended behavious?

Moritz Balz verteiler@mbalz.de
Mon, 26 Aug 2002 14:11:30 +0200


Was there already a bug filed for this? (Did'nt find any.)
I struggled with this for the last days.

It seems that directory names do never end with "/"
So calling DirectoryInfo.Parent from, say, "/home", returns "".

But the root dir itself is "/", so there is some inconsistency.
"" is never recognized as root dir, so the Parent of "" returns
something - the current directory, or sometimes null.

I think either all dir names must end with "/", or "" must denote the
root dir.


A Rafael D Teixeira wrote:

>> From: Hans-Jürgen Schönig <mono@cybertec.at>
>> Reply-To: hs@cybertec.at
>> To: mono-list@ximian.com
>> Subject: [Mono-list] Is it the intended behavious?
>> Date: Sun, 25 Aug 2002 19:06:50 +0200
>>
>> I have written a small test application:
>>
>> using System;
>> using System.IO;
>>
>> public class Demo
>> {
>>        public static void Main(string[] args)
>>        {
>>                if      (args.Length > 0)
>>                {
>>                        DirectoryInfo data = new DirectoryInfo(args[0]);
>>                        Console.WriteLine("Name: " + data.Name);
>>                        Console.WriteLine("Name vollstaenig: "
>>                                + data.FullName);
>>                        Console.WriteLine("Attribute: "
>>                                + data.Attributes);
>>                        Console.WriteLine("Vater: " + data.Parent);
>>                        Console.WriteLine("Wurzel: " + data.Root);
>>                        Console.WriteLine("Erstellt am: "
>>                                + data.CreationTime);
>>                        Console.WriteLine("Letzter Zugriff: "
>>                                + data.LastAccessTime);
>>                        Console.WriteLine("Letzter Schreibzugriff: "
>>                                + data.LastWriteTime);
>>                }
>>        }
>> }
>>
>> When running the application the behaviour seems to be strange.
>> Is it the intented behavious? (watch the slashes):
>>
>> [hs@duron io]$ mono file.exe /usr/local/src/
>> Name: /usr/local/src/
>> Attribute: Directory
>> Vater: /usr/local/src
>> Wurzel: /
>> Erstellt am: 02/06/1996 21:04:01
>> Letzter Zugriff: 08/25/2002 02:05:44
>> Letzter Schreibzugriff: 02/06/1996 21:04:01
>> [hs@duron io]$ vi file.cs
>> [hs@duron io]$ mono file.exe /usr/local/src
>> Name: /usr/local/src
>> Attribute: Directory
>> Vater: /usr/local
>> Wurzel: /
>> Erstellt am: 02/06/1996 21:04:01
>> Letzter Zugriff: 08/25/2002 02:05:44
>> Letzter Schreibzugriff: 02/06/1996 21:04:01
>>
>> Is it a bug or a feature?
>> Unfortunately I don't have the chance to test it on Window$.
>>
>>    Hans
>
>
> Run on my Win2000 system on csc/ms.net:
>
> C:\cygwin\tmp\ConsoleApplication1\bin\Debug>consoleapplication1 .
> Name: Debug
> Name vollstaenig: C:\cygwin\tmp\ConsoleApplication1\bin\Debug
> Attribute: Directory
> Vater: bin
> Wurzel: C:\
> Erstellt am: 25/8/2002 14:18:04
> Letzter Zugriff: 25/8/2002 14:28:01
> Letzter Schreibzugriff: 25/8/2002 14:18:35
>
> There seems to have a difference on what the Parent (Vater) member
> returns, please fill a bugzilla...
>
> The Root (Wurzel) member is correctly returning the / dir, because
> Linux does not have the drive letter concept.
>
> About slashes versus backslashes, you have to verify what is valid for
> the platform, through System.IO.Path.DirectorySeparatorChar.
>
> Hope it helps...
>
>
> Rafael Teixeira
> Brazilian Polymath
>
>
>
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>
> _______________________________________________
> Mono-list maillist  -  Mono-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>