From: Anders Wirzenius <anders@no.email.thanks.invalid>
Subject: File list on Windows and Debian
Date: Mon, 19 Jun 2006 08:09:51 GMT
Date: 2006-06-19T08:09:51+00:00 [thread overview]
Message-ID: <uhd2h4ldc.fsf@no.email.thanks.invalid> (raw)
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)?
with Gnat.Directory_Operations;
with Ada.Command_Line;
with Ada.Exceptions;
with Ada.Text_IO;
with POSIX;
with POSIX_Files;
with Ada.Strings.Fixed;
procedure Ordning is
use Ada;
use Ada.Command_Line;
use Ada.Text_IO;
use POSIX;
use POSIX_Files;
procedure Display (Dirent : in Directory_Entry;
Quit : in out Boolean) is
File_Name : String := To_String (Filename_Of (Dirent));
begin
Put_Line (File_Name);
end Display;
procedure Display_Directory is
new For_Every_Directory_Entry (Action => Display);
begin
declare
use Gnat.Directory_Operations;
This_Dir : Dir_Type;
This_File: Dir_Name_Str (1..50);
Last : Natural;
begin
--
-- First using Gnat.Directory_Operations
--
Put_Line ("First using Gnat.Directory_Operations");
Put_Line ("-------------------------------------");
Open (This_Dir, Get_Current_Dir);
loop
Read (This_Dir, This_File, Last);
exit when Last=0;
Put_Line (This_File (1..Last));
end loop;
Close (This_Dir);
Put_Line ("-------------------------------------");
end;
--
-- next using POSIX
--
Put_Line ("next using POSIX");
Put_Line ("-------------------------------------");
Display_Directory (To_POSIX_String ("."));
exception
when E : others =>
Put_Line (Exceptions.Exception_Name (E) & " - " &
Exceptions.Exception_Message (E) & " : " &
POSIX.Image (POSIX.Get_Error_Code));
end Ordning;
TIA
--
Anders
next reply other threads:[~2006-06-19 8:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-19 8:09 Anders Wirzenius [this message]
2006-06-20 8:06 ` File list on Windows and Debian Ludovic Brenta
2006-06-20 10:23 ` Anders Wirzenius
2006-06-20 11:59 ` M E Leypold
2006-06-21 6:13 ` Anders Wirzenius
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox