Commit c2a49ce6 by Vincent Celier Committed by Arnaud Charlet

a-dirval-vms.adb, [...] (Windows): New Boolean function.

2007-04-20  Vincent Celier  <celier@adacore.com>

	* a-dirval-vms.adb, a-dirval.ads, a-dirval.adb (Windows): New Boolean
	function.

	* a-dirval-mingw.adb (Is_Valid_Path_Name): Forbid a path with a drive
	letter if it is not followed by a '/' or a '\'.
	(Windows): New Boolean function

	* a-direct.ads, a-direct.adb: Remove unnecessary and misplaced pragma
	Ada 2005.
	(Containing_Directory): On Windows, keep at least one '/' or '\' after a
	drive letter.
	(Containing_Directory): Raise Use_Error when the directory is a root
	directory.
	(Extension): When returning the result, use a conversion to Result_Type,
	not a qualification.

From-SVN: r125468
parent cb65368d
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2006, Free Software Foundation, Inc. --
-- Copyright (C) 2004-2007, Free Software Foundation, Inc. --
-- --
-- This specification is derived for use with GNAT from AI-00248, which is --
-- expected to be a part of a future expected revised Ada Reference Manual. --
......@@ -77,9 +77,6 @@ with Ada.Strings.Unbounded;
package Ada.Directories is
pragma Ada_05;
-- To be removed later ???
-----------------------------------
-- Directory and File Operations --
-----------------------------------
......@@ -322,7 +319,7 @@ package Ada.Directories is
-- End_Search, the object Search will have no entries available. Note
-- that is is not necessary to call End_Search if the call to Start_Search
-- was unsuccessful and raised an exception (but it is harmless to make
-- the call in this case)>
-- the call in this case).
function More_Entries (Search : Search_Type) return Boolean;
-- Returns True if more entries are available to be returned by a call
......
......@@ -7,7 +7,7 @@
-- B o d y --
-- (Windows Version) --
-- --
-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- Copyright (C) 2004-2007, 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- --
......@@ -80,6 +80,16 @@ package body Ada.Directories.Validity is
Name (Start) in 'a' .. 'z')
then
Start := Start + 2;
-- A drive letter followed by a colon and followed by nothing or
-- by a relative path is an ambiguous path name on Windows, so we
-- don't accept it.
if Start > Name'Last
or else (Name (Start) /= '/' and then Name (Start) /= '\')
then
return False;
end if;
end if;
loop
......@@ -162,4 +172,13 @@ package body Ada.Directories.Validity is
return False;
end OpenVMS;
-------------
-- Windows --
-------------
function Windows return Boolean is
begin
return True;
end Windows;
end Ada.Directories.Validity;
......@@ -7,7 +7,7 @@
-- B o d y --
-- (VMS Version) --
-- --
-- Copyright (C) 2004-2006 Free Software Foundation, Inc. --
-- Copyright (C) 2004-2007, 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- --
......@@ -98,7 +98,7 @@ package body Ada.Directories.Validity is
end if;
end loop;
-- If name include a dot, it can only be ".", ".." or a the last
-- If name include a dot, it can only be ".", ".." or the last
-- file name.
if Dot_Found then
......@@ -190,4 +190,13 @@ package body Ada.Directories.Validity is
return True;
end OpenVMS;
-------------
-- Windows --
-------------
function Windows return Boolean is
begin
return False;
end Windows;
end Ada.Directories.Validity;
......@@ -7,7 +7,7 @@
-- B o d y --
-- (POSIX Version) --
-- --
-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- Copyright (C) 2004-2007, 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- --
......@@ -103,4 +103,13 @@ package body Ada.Directories.Validity is
return False;
end OpenVMS;
-------------
-- Windows --
-------------
function Windows return Boolean is
begin
return False;
end Windows;
end Ada.Directories.Validity;
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- Copyright (C) 2004-2007, 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- --
......@@ -48,4 +48,7 @@ private package Ada.Directories.Validity is
function OpenVMS return Boolean;
-- Return True when OS is OpenVMS
function Windows return Boolean;
-- Return True when OS is Windows
end Ada.Directories.Validity;
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