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: 103376,660973a335e8cfa0 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!feeder.news-service.com!feeder1.cambrium.nl!feed.tweaknews.nl!amsnews11.chello.com!uio.no!newsfeed1.funet.fi!newsfeeds.funet.fi!feeder1.news.jippii.net!nntp.inet.fi!central1.inet.fi!inet.fi!read3.inet.fi.POSTED!53ab2750!not-for-mail Sender: AWI003@FIW9430 Newsgroups: comp.lang.ada Subject: Re: File list on Windows and Debian References: <1150790778.224228.282310@y41g2000cwy.googlegroups.com> From: Anders Wirzenius Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 21 Jun 2006 06:13:46 GMT NNTP-Posting-Host: 194.251.142.2 X-Complaints-To: abuse@inet.fi X-Trace: read3.inet.fi 1150870426 194.251.142.2 (Wed, 21 Jun 2006 09:13:46 EEST) NNTP-Posting-Date: Wed, 21 Jun 2006 09:13:46 EEST Organization: Sonera corp Internet services Xref: g2news2.google.com comp.lang.ada:4869 Date: 2006-06-21T06:13:46+00:00 List-Id: "Ludovic Brenta" writes: > Anders Wirzenius writes : > > I am trying to process files in a directory. They have to be processed > > in alphabetical order. With following code I get a nice sorted list on > > Windows XP but not sorted at all on Linux Debian. Have I missed > > something that switches the sorting on on Debian (Sarge)? > > I tried your program at home, and had to tweak it a little bit for it > to compile. Then I also ghot unsorted directory entries, like I did > with another program I wrote. > > I think this is by design on GNU/Linux systems. They don't impose the > overhead of sorting potentially large numbers of directory entries > unless you really need to sort them. > > If you insist on sorting, you'd have to do that yourself: first, store > the directory entries (perhaps as GNAT.OS_Lib.String_Access values) in > a container and sort it. I would suggest either GNAT.Dynamic_Tables and > GNAT.Heap_Sort_G, or Charles.Vectors.Unbounded.Generic_Sort in the > libcharles0-dev package. Beware however of unbounded memory usage. > > HTH > > -- > Ludovic Brenta. > I found the package OS_Services which does the job. It uses GNAT.Heap_Sort_G. Many thanks to J-P Rosen for a very useful package. -- Anders