diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-06-25 11:18:43 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-06-25 11:18:43 +0200 |
commit | 5b900a4520087e5e38fe938e55932e6bd779d1e9 (patch) | |
tree | 9985a90114e8cc5c0d37f35599fac92a57c4698b /gcc/ada/s-os_lib.adb | |
parent | a2b62f99d5c193d5d6e6b16777501338cc519789 (diff) | |
download | gcc-5b900a4520087e5e38fe938e55932e6bd779d1e9.zip gcc-5b900a4520087e5e38fe938e55932e6bd779d1e9.tar.gz gcc-5b900a4520087e5e38fe938e55932e6bd779d1e9.tar.bz2 |
[multiple changes]
2009-06-25 Vincent Celier <celier@adacore.com>
* s-os_lib.adb (Normalize_Pathname.Get_Directory): If directory
provided, on Windows change all '/' to '\'.
* fmap.ads, fmap.adb (Remove_Forbidden_File_Name): Remove, no longer
used. Minor comment changes
* prj-nmsc.adb: Do not call Fmap.Add_Forbidden_File_Name or
Remove_Forbidden_File_Name.
2009-06-25 Quentin Ochem <ochem@adacore.com>
* prj.ads (Unit_Index): Now general access type.
From-SVN: r148936
Diffstat (limited to 'gcc/ada/s-os_lib.adb')
-rwxr-xr-x | gcc/ada/s-os_lib.adb | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/gcc/ada/s-os_lib.adb b/gcc/ada/s-os_lib.adb index e24a02e..0f2081a 100755 --- a/gcc/ada/s-os_lib.adb +++ b/gcc/ada/s-os_lib.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1995-2008, AdaCore -- +-- Copyright (C) 1995-2009, AdaCore -- -- -- -- 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- -- @@ -1800,20 +1800,32 @@ package body System.OS_Lib is ------------------- function Get_Directory (Dir : String) return String is + Result : String (1 .. Dir'Length + 1); + Length : constant Natural := Dir'Length; + begin -- Directory given, add directory separator if needed - if Dir'Length > 0 then - if Dir (Dir'Last) = Directory_Separator then - return Dir; + if Length > 0 then + Result (1 .. Length) := Dir; + + -- On Windows, change all '/' to '\' + + if On_Windows then + for J in 1 .. Length loop + if Result (J) = '/' then + Result (J) := Directory_Separator; + end if; + end loop; + end if; + + -- Add directory separator, if needed + + if Result (Length) = Directory_Separator then + return Result (1 .. Length); else - declare - Result : String (1 .. Dir'Length + 1); - begin - Result (1 .. Dir'Length) := Dir; - Result (Result'Length) := Directory_Separator; - return Result; - end; + Result (Result'Length) := Directory_Separator; + return Result; end if; -- Directory name not given, get current directory |