From 98d68cf1e21e23331a95c636f43fe769d02e9677 Mon Sep 17 00:00:00 2001 From: Vincent Celier Date: Fri, 31 Aug 2007 12:24:29 +0200 Subject: [PATCH] tempdir.adb: On VMS, take into account GNUTMPDIR before TMPDIR 2007-08-31 Vincent Celier * tempdir.adb: On VMS, take into account GNUTMPDIR before TMPDIR From-SVN: r127982 --- gcc/ada/tempdir.adb | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/gcc/ada/tempdir.adb b/gcc/ada/tempdir.adb index 7044271532f..cc13a4c1643 100644 --- a/gcc/ada/tempdir.adb +++ b/gcc/ada/tempdir.adb @@ -26,16 +26,18 @@ with GNAT.Directory_Operations; use GNAT.Directory_Operations; -with Opt; use Opt; -with Output; use Output; +with Hostparm; use Hostparm; +with Opt; use Opt; +with Output; use Output; package body Tempdir is Tmpdir_Needs_To_Be_Displayed : Boolean := True; - Tmpdir : constant String := "TMPDIR"; - No_Dir : aliased String := ""; - Temp_Dir : String_Access := No_Dir'Access; + Tmpdir : constant String := "TMPDIR"; + Gnutmpdir : constant String := "GNUTMPDIR"; + No_Dir : aliased String := ""; + Temp_Dir : String_Access := No_Dir'Access; ---------------------- -- Create_Temp_File -- @@ -114,9 +116,24 @@ package body Tempdir is begin declare - Dir : String_Access := Getenv (Tmpdir); + Dir : String_Access; begin + -- On VMS, if GNUTMPDIR is defined, use it + + if OpenVMS then + Dir := Getenv (Gnutmpdir); + + -- Otherwise, if GNUTMPDIR is not defined, try TMPDIR + + if Dir'Length = 0 then + Dir := Getenv (Tmpdir); + end if; + + else + Dir := Getenv (Tmpdir); + end if; + if Dir'Length > 0 and then Is_Absolute_Path (Dir.all) and then Is_Directory (Dir.all) -- 2.30.2