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 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Bill Findlay Newsgroups: comp.lang.ada Subject: Re: File name wild cards Date: Thu, 16 Aug 2018 15:26:56 +0100 Organization: none Message-ID: <0001HW.2125C1300B5101E870000F8CF2CF@news.individual.net> References: <0001HW.2124C8650B16B24770000F8CF2CF@news.individual.net> Reply-To: findlaybill@blueyonder.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: individual.net yoLpDf+ojxtcCW/1WGCAJQrBwu95yPE35oTNsxV0YqBJIoSfGP X-Orig-Path: not-for-mail Cancel-Lock: sha1:HTESsPTj5QADRS9Xp5ZaobLpIlY= User-Agent: Hogwasher/5.19 Xref: reader02.eternal-september.org comp.lang.ada:54181 Date: 2018-08-16T15:26:56+01:00 List-Id: On 16 Aug 2018, Jeffrey R. Carter wrote (in article ): > On 08/15/2018 10:45 PM, Bill Findlay wrote: > > Can anyone point me to a portable way of doing wildcard filename lookups? > > > > In Ada.Directories we have; > > > > > type Search_Type is limited private; > > > procedure Start_Search (Search: in out Search_Type; > > > Directory: in String; > > > Pattern: in String; > > > Filter: in Filter_Type := (others => True)); > > > > etc > > But the interpretation of Pattern is implementation defined. > > I interpret this as being like the Form parameter for opening a file. It's > whatever's meaningful for the actual platform being used. > > There's no way to be completely portable, since even the way one specifies a > directory can vary significantly between file systems. I had been told that Java had a portable way of doing it, but was sceptical for exactly the reason you state. > Assuming you have a way of specifying the directory that is acceptably portable > for your uses, one way to portably select only files that match some pattern is > to pass Pattern => "" and select files that match your pattern internally, > perhaps using a regular-expression pkg. Simple, obvious, why didn't I think of that? 8-) Thanks, Jeff. -- Bill Findlay