Commit 98d68cf1 by Vincent Celier Committed by Arnaud Charlet

tempdir.adb: On VMS, take into account GNUTMPDIR before TMPDIR

2007-08-31  Vincent Celier  <celier@adacore.com>

	* tempdir.adb: On VMS, take into account GNUTMPDIR before TMPDIR

From-SVN: r127982
parent f33abf26
...@@ -26,16 +26,18 @@ ...@@ -26,16 +26,18 @@
with GNAT.Directory_Operations; use GNAT.Directory_Operations; with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with Opt; use Opt; with Hostparm; use Hostparm;
with Output; use Output; with Opt; use Opt;
with Output; use Output;
package body Tempdir is package body Tempdir is
Tmpdir_Needs_To_Be_Displayed : Boolean := True; Tmpdir_Needs_To_Be_Displayed : Boolean := True;
Tmpdir : constant String := "TMPDIR"; Tmpdir : constant String := "TMPDIR";
No_Dir : aliased String := ""; Gnutmpdir : constant String := "GNUTMPDIR";
Temp_Dir : String_Access := No_Dir'Access; No_Dir : aliased String := "";
Temp_Dir : String_Access := No_Dir'Access;
---------------------- ----------------------
-- Create_Temp_File -- -- Create_Temp_File --
...@@ -114,9 +116,24 @@ package body Tempdir is ...@@ -114,9 +116,24 @@ package body Tempdir is
begin begin
declare declare
Dir : String_Access := Getenv (Tmpdir); Dir : String_Access;
begin 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 if Dir'Length > 0 and then
Is_Absolute_Path (Dir.all) and then Is_Absolute_Path (Dir.all) and then
Is_Directory (Dir.all) Is_Directory (Dir.all)
......
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