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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,e96fdf9557794655 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.tele.dk!feed118.news.tele.dk!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail Date: Wed, 07 Oct 2009 19:06:44 +0200 From: =?ISO-8859-1?Q?Thomas_L=F8cke?= <"tl at ada-dk.org"> Organization: Ada DK User-Agent: Thunderbird 2.0.0.23 (X11/20090812) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada.Directories.Base_Name and dot files References: <4acc8c20$0$284$14726298@news.sunsite.dk> <09eb2709-aa43-460f-9db1-7228b4ff38ef@12g2000pri.googlegroups.com> In-Reply-To: <09eb2709-aa43-460f-9db1-7228b4ff38ef@12g2000pri.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <4acccaa4$0$283$14726298@news.sunsite.dk> NNTP-Posting-Host: 83.91.213.86 X-Trace: news.sunsite.dk DXC=@F=@iTYjmi92]0d4PBaYSB=nbEKnk;cWN^LcTk:769HanD:b=JL1=UiO>Z:P6O3aX>>FJ?M`38olDWHGk>LH>LiZjcK^@Fo7 X-Complaints-To: staff@sunsite.dk Xref: g2news2.google.com comp.lang.ada:8608 Date: 2009-10-07T19:06:44+02:00 List-Id: Adam Beneschan wrote: > I'm assuming you're using Linux or some other Unix-type system? Yes, Slackware Linux. > Although the exact meanings of the Ada.Directories operations are > implementation-dependent, the AARM gives the "expected interpretation" > on Unix-type and Windows systems. (AARM A.16(1.a)) AARM A.16(80.a) > says, 'For Unix and Windows�, the base name is the portion of the > simple name preceding the rightmost period (except for the special > directory names "." and "..", whose Base_Name is "." and "..").' Yes, I understand that and it's that exact design decision that made me wonder. If the first character of a file name is a period, why is it then better to return a null string as the base name, instead of, for example, the period plus any characters following the period, up until the last period, ie. ".secret" would yield ".secret" as the base name and ".secret.conf.save" would yield ".secret.conf" So I understand what it is doing, I just don't understand why. The null string design baffles me. While writing this, I can though see that the null string sends a pretty clear signal to the programmer: This file is not "normal". You should probably take a close look at it, and figure out what you want. I guess that's actually a pretty good thing. Except on some systems a dot file might be completely normal. Hehe, there's just no winning here! :D > Unlike VAX/VMS, where every file has a definite, separate "base" and > "extension" name (the extension name can be blank), Unix is a lot > looser (and Windows is a little bit looser). RM A.16(78) says, "The > extension name is a portion of a simple name (not including any > separator characters), typically used to identify the file class." On > Unix, this is only the case sometimes. For source files, it's often > true, and also for other files like .o (object) files. But it's not > consistent. Executable files don't have an extension. Files > beginning with a dot are usually "hidden" files with some control > information, and I wouldn't expect them to fall into the "basename-dot- > extension" pattern that other file names fall into. When I make a > backup copy of a file, I'll often just append .save to the file name, > but I wouldn't consider ".save" to be an extension, and it certainly > doesn't identify the file class. But I wouldn't expect an application > to read my mind and know that. Gotcha! > So the Base_Name and Extension functions aren't going to be > appropriate for every file name on Unix, since not all Unix files have > definite base names and extensions. Bottom line: if you know what you > want, just use the string functions and do it yourself. > > -- Adam Yes, that was also my first thought: Some manual parsing is necessary for "special" cases. Thank you for your reply Adam. :o) -- Regards, Thomas L�cke Email: tl at ada-dk.org Web: http:ada-dk.org IRC nick: ThomasLocke