From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,96296bb60aa5db9 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wn14feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: Ada.Directories Reply-To: anon@anon.org (anon) References: <1o4hp0vtlenw0.jql7yewhhr4a.dlg@40tude.net> X-Newsreader: IBM NewsReader/2 2.0 Message-ID: Date: Sun, 21 Oct 2007 01:25:57 GMT NNTP-Posting-Host: 12.65.192.95 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1192929957 12.65.192.95 (Sun, 21 Oct 2007 01:25:57 GMT) NNTP-Posting-Date: Sun, 21 Oct 2007 01:25:57 GMT Organization: AT&T Worldnet Xref: g2news2.google.com comp.lang.ada:2518 Date: 2007-10-21T01:25:57+00:00 List-Id: The "." and ".." are not aliases they are actual directory entries in each directory, except for FAT partitions. Note: Any directory can have sub-directories with the same name that exist in other directories or sub-directories. Just that in this case the "." and ".." each have specific value set by the file system drivers under the operating system. Like: / (root) => . -- point to / aka root .. -- point to / aka root ( special case ) sub-dir_0 => . -- point to /sub-dir_0 .. -- point to / aka root sub-dir_2 => . -- point to /sub-dir_0/sub-dir_2 .. -- point to /sub-dir_0 ... Now in using the Directory_Search ( "/Sub_Dir_0/Sub_Dir_2_0/*" ) First entry would be a record that contain the Entry_ID "." and a allocation_link of "/Sub_Dir_0/Sub_Dir_2_0 Second entry would be a record that contain the Entry_ID ".." and a allocation_link will be "/Sub_Dir_0 The file system designer and OS designer even though you do not like it, created a standard that uses "." to mean current directory and ".." to represent the current directory parent directory. This has nothing to do with GNAT or Ada. The file system standards have been adopted by the "Ada Standards" for Ada 2005. In general, that means that Ada.Directory and its sub packages link to the OS user routines and insert the data into a Directory Record that is in the "Ada Standards". Which means you are dealing with specfic details of the OS file system that can be use in any language. Also, there is no direct way to render the "." or ".." to its name true name, in any language. You must build a routine that first compares the allocation of "." and "..", if equal then current directory is root. Else the routine searches the parent directory ("..") for the same allocation as the current directory ("."). Once found then the name_id is the current directory name. In <1o4hp0vtlenw0.jql7yewhhr4a.dlg@40tude.net>, "Dmitry A. Kazakov" writes: >On Sat, 20 Oct 2007 18:43:21 GMT, anon wrote: > >> Its a "File System" feature! >> >> In today's file systems, the first two entries are "." and ".." directories. >> One exception to this rule is the FAT file systems which does not contain >> these two entries. > >Neither the root directory of a volume does. But that is irrelevant to the >issue. > >> So if you seach the entire directory, the first two names that will be >> returned are "." and ".." unless you search a FAT partition or a floopy. >> >> All languages including Ada, C, JAVA that have directory search routine >> will act in same way. > >I don't care how an OS-specific search might work. That is actually the >reason why I use Ada.Directories, which abstracts any concrete OS. So the >question is whether appearance of ".." is a requirement. Maybe, ".." is an >alias name? But then > >1. Why there is no File_Kind value for aliases? > >2. Why Full_Name of the Directory_Entry corresponding to ".." does not >render the true name of? Can the same file have different full names? > >-- >Regards, >Dmitry A. Kazakov >http://www.dmitry-kazakov.de