with Ada.Text_IO;
with Ada.Directories;
procedure aDir is
package IO renames Ada.Text_IO;
package D renames Ada.Directories;
begin
IO.Put ("Starting default directory: ");
IO.Put_Line (Item => D.Current_Directory);
IO.Put_Line (Item => D.Compose (Containing_Directory => "foo/",
Name => "bar",
Extension => "conf"));
IO.Put_Line (Item => D.Compose (Containing_Directory => "",
Name => "bar",
Extension => "conf"));
IO.Put_Line (Item => D.Compose (Containing_Directory => "/foo",
Name => "bar",
Extension => ""));
IO.Put_Line (Item => D.Compose (Containing_Directory => "/foo",
Name => "bar.conf",
Extension => ""));
IO.Put_Line (Item => D.Compose (Containing_Directory => "/foo",
Name => "",
Extension => "conf"));
IO.Put_Line (Item => D.Compose (Containing_Directory => "",
Name => "",
Extension => "conf"));
IO.Put_Line (Item => D.Compose (Containing_Directory => "foo/",
Name => "",
Extension => ""));
-- Force Name_Error by omitting Name and Extension
exception
when D.Name_Error =>
IO.Put_Line (Item => "Name_Error raised.");
end aDir;