diff options
Diffstat (limited to 'gcc/ada/gnatchop.adb')
-rw-r--r-- | gcc/ada/gnatchop.adb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/ada/gnatchop.adb b/gcc/ada/gnatchop.adb index 509a6f3b237..29bb2e9225f 100644 --- a/gcc/ada/gnatchop.adb +++ b/gcc/ada/gnatchop.adb @@ -1672,6 +1672,38 @@ procedure Gnatchop is -- Start of processing for gnatchop begin + -- Add the directory where gnatchop is invoked in front of the + -- path, if gnatchop is invoked with directory information. + -- Only do this if the platform is not VMS, where the notion of path + -- does not really exist. + + if not Hostparm.OpenVMS then + declare + Command : constant String := Command_Name; + + begin + for Index in reverse Command'Range loop + if Command (Index) = Directory_Separator then + declare + Absolute_Dir : constant String := + Normalize_Pathname + (Command (Command'First .. Index)); + + PATH : constant String := + Absolute_Dir & + Path_Separator & + Getenv ("PATH").all; + + begin + Setenv ("PATH", PATH); + end; + + exit; + end if; + end loop; + end; + end if; + -- Process command line options and initialize global variables if not Scan_Arguments then |