Commit 8ee45952 by Vincent Celier Committed by Arnaud Charlet

a-direct.adb (Start_Search): Raise Use_Error if the directory is not readable.

2008-03-26  Vincent Celier  <celier@adacore.com>

	* a-direct.adb (Start_Search): Raise Use_Error if the directory is not
	readable.

From-SVN: r133581
parent 9a18e785
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2004-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2004-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -1197,10 +1197,15 @@ package body Ada.Directories is
C_File_Name : constant String := Directory & ASCII.NUL;
begin
-- First, the invalid case
-- First, the invalid cases
if not Is_Directory (Directory) then
raise Name_Error;
raise Name_Error
with "unknown directory """ & Simple_Name (Directory) & '"';
elsif not Is_Readable_File (Directory) then
raise Use_Error
with "unreadable directory """ & Simple_Name (Directory) & '"';
end if;
-- If needed, finalize Search
......@@ -1219,7 +1224,8 @@ package body Ada.Directories is
exception
when Error_In_Regexp =>
Free (Search.Value);
raise Name_Error;
raise Name_Error
with "invalid pattern """ & Pattern & '"';
end;
-- Initialize some Search components
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment