comp.lang.ada
 help / color / mirror / Atom feed
* Ada.Directories and network shares
@ 2010-07-17 10:43 Dmitry A. Kazakov
  2010-08-16 19:16 ` Yannick Duchêne (Hibou57)
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry A. Kazakov @ 2010-07-17 10:43 UTC (permalink / raw)


It seems that Ada.Directories is broken. Neither under Fedora or Debian the
following can walk a network share (cifs). The following does not work with
mounted shares:

with Ada.Directories;  use Ada.Directories;
with Ada.Text_IO;
 
procedure Test_Directory_Walk is
   procedure Walk (Name : String; Pattern : String) is
      procedure Print (Item : Directory_Entry_Type) is
      begin
         Ada.Text_IO.Put_Line (Full_Name (Item));
      end Print;
      procedure Walk (Item : Directory_Entry_Type) is
      begin
         if Simple_Name (Item) /= "." and then Simple_Name (Item) /= ".."
         then
            Walk (Full_Name (Item), Pattern);
         end if;
      exception
         when Name_Error => null;
      end Walk;
   begin
      Search (Name, Pattern, (others => True), Print'Access);
      Search (Name, "*", (Directory => True, others => False),
         Walk'Access);
   end Walk;
begin
   Walk (".", "*");
end Test_Directory_Walk;

When starting at the directory containing the mounting point, the result is
that the mounting point is not printed at all. When cd at the mounting
point and starting it there, then the result is:

raised ADA.IO_EXCEPTIONS.NAME_ERROR : unknown directory ""

P.S. GNAT GPL 2010 seem to work, but I have a suspicion that it has some
issues as well. I didn't figured yet when and which.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Ada.Directories and network shares
  2010-07-17 10:43 Ada.Directories and network shares Dmitry A. Kazakov
@ 2010-08-16 19:16 ` Yannick Duchêne (Hibou57)
  2010-08-16 19:31   ` Dmitry A. Kazakov
  0 siblings, 1 reply; 3+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-08-16 19:16 UTC (permalink / raw)


Le Sat, 17 Jul 2010 12:43:15 +0200, Dmitry A. Kazakov  
<mailbox@dmitry-kazakov.de> a écrit:

> It seems that Ada.Directories is broken. Neither under Fedora or Debian  
> the
> following can walk a network share (cifs). The following does not work  
> with
> mounted shares:

Not the same case as yours, I also get into troubles with Ada.Directories  
and some characters in file names. This made though this may be a good  
idea to create your own if the target platform is known or are known.

The trouble that I could not even work around using exception handlers,  
because as soon a exception occurred, all the directory exploration was  
break (no way to resume at the next item).



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Ada.Directories and network shares
  2010-08-16 19:16 ` Yannick Duchêne (Hibou57)
@ 2010-08-16 19:31   ` Dmitry A. Kazakov
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry A. Kazakov @ 2010-08-16 19:31 UTC (permalink / raw)


On Mon, 16 Aug 2010 21:16:40 +0200, Yannick Duch�ne (Hibou57) wrote:

> Le Sat, 17 Jul 2010 12:43:15 +0200, Dmitry A. Kazakov  
> <mailbox@dmitry-kazakov.de> a �crit:
> 
>> It seems that Ada.Directories is broken. Neither under Fedora or Debian the
>> following can walk a network share (cifs). The following does not work with
>> mounted shares:
> 
> Not the same case as yours, I also get into troubles with Ada.Directories  
> and some characters in file names.

Ada.Directory is broken per design because it does not abstract file names
encoding. Evidently it must have been either UTF-8 or else
Wide_Wide_Character.

> This made though this may be a good  
> idea to create your own if the target platform is known or are known.

Well, since I am using GtkAda for all cases where Ada.Directory could come
in question, I just switched to Glib. Glib works so far and, I hate to have
to say this, was designed more reasonable than Ada.Directories was in terms
of OS-independency as well as functionality.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-16 19:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-17 10:43 Ada.Directories and network shares Dmitry A. Kazakov
2010-08-16 19:16 ` Yannick Duchêne (Hibou57)
2010-08-16 19:31   ` Dmitry A. Kazakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox