Commit 6a294a29 by Vincent Celier Committed by Arnaud Charlet

a-dirval-mingw.adb (Invalid_Character): Add '\' as invalid character in file name.

2004-10-04  Vincent Celier  <celier@gnat.com>

	* a-dirval-mingw.adb (Invalid_Character): Add '\' as invalid character
	in file name.
	(Is_Valid_Path_Name): Take '/' as a directory separator.

From-SVN: r88492
parent 9a080ea3
2004-10-04 Vincent Celier <celier@gnat.com> 2004-10-04 Vincent Celier <celier@gnat.com>
* a-dirval-mingw.adb (Invalid_Character): Add '\' as invalid character
in file name.
(Is_Valid_Path_Name): Take '/' as a directory separator.
2004-10-04 Vincent Celier <celier@gnat.com>
* prj-part.adb (Parse_Single_Project): Call Is_Extending_All * prj-part.adb (Parse_Single_Project): Call Is_Extending_All
(Extended_Project) only if Extended_Project is defined, to avoid (Extended_Project) only if Extended_Project is defined, to avoid
assertion error. assertion error.
......
...@@ -39,7 +39,7 @@ with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; ...@@ -39,7 +39,7 @@ with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
package body Ada.Directories.Validity is package body Ada.Directories.Validity is
Invalid_Character : constant array (Character) of Boolean := Invalid_Character : constant array (Character) of Boolean :=
(NUL .. US => True, (NUL .. US | '\' => True,
'/' | ':' | '*' | '?' => True, '/' | ':' | '*' | '?' => True,
'"' | '<' | '>' | '|' => True, '"' | '<' | '>' | '|' => True,
DEL .. NBSP => True, DEL .. NBSP => True,
...@@ -76,7 +76,9 @@ package body Ada.Directories.Validity is ...@@ -76,7 +76,9 @@ package body Ada.Directories.Validity is
loop loop
-- Look for the start of the next directory or file name -- Look for the start of the next directory or file name
while Start <= Name'Last and then Name (Start) = '\' loop while Start <= Name'Last and then
(Name (Start) = '\' or Name (Start) = '/')
loop
Start := Start + 1; Start := Start + 1;
end loop; end loop;
...@@ -89,7 +91,7 @@ package body Ada.Directories.Validity is ...@@ -89,7 +91,7 @@ package body Ada.Directories.Validity is
-- Look for the end of the directory/file name -- Look for the end of the directory/file name
while Last < Name'Last loop while Last < Name'Last loop
exit when Name (Last + 1) = '\'; exit when Name (Last + 1) = '\' or Name (Last + 1) = '/';
Last := Last + 1; Last := Last + 1;
end loop; end loop;
...@@ -119,7 +121,7 @@ package body Ada.Directories.Validity is ...@@ -119,7 +121,7 @@ package body Ada.Directories.Validity is
begin begin
-- A file name cannot be empty, cannot contain more than 256 characters, -- A file name cannot be empty, cannot contain more than 256 characters,
-- and cannot contain invalid characters, including '\' -- and cannot contain invalid characters.
if Name'Length = 0 or else Name'Length > 256 then if Name'Length = 0 or else Name'Length > 256 then
return False; return False;
...@@ -129,7 +131,7 @@ package body Ada.Directories.Validity is ...@@ -129,7 +131,7 @@ package body Ada.Directories.Validity is
else else
Only_Spaces := True; Only_Spaces := True;
for J in Name'Range loop for J in Name'Range loop
if Invalid_Character (Name (J)) or else Name (J) = '\' then if Invalid_Character (Name (J)) then
return False; return False;
elsif Name (J) /= ' ' then elsif Name (J) /= ' ' then
Only_Spaces := False; Only_Spaces := False;
......
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