-- --
------------------------------------------------------------------------------
+with Ada.Text_IO; use Ada.Text_IO;
+
with Fmap;
with Hostparm;
with Makeutl; use Makeutl;
New_Len : Positive;
New_Last : Positive;
- Ada_Project_Path : constant String := "ADA_PROJECT_PATH";
- Gpr_Project_Path : constant String := "GPR_PROJECT_PATH";
- -- Name of alternate env. variable that contain path name(s) of
- -- directories where project files may reside. GPR_PROJECT_PATH has
- -- precedence over ADA_PROJECT_PATH.
-
- Gpr_Prj_Path : String_Access;
- Ada_Prj_Path : String_Access;
+ Ada_Project_Path : constant String := "ADA_PROJECT_PATH";
+ Gpr_Project_Path : constant String := "GPR_PROJECT_PATH";
+ Gpr_Project_Path_File : constant String := "GPR_PROJECT_PATH_FILE";
+ -- Names of alternate env. variable that contain path name(s) of
+ -- directories where project files may reside. They are taken into
+ -- account in this order: GPR_PROJECT_PATH_FILE, GPR_PROJECT_PATH,
+ -- ADA_PROJECT_PATH.
+
+ Gpr_Prj_Path_File : String_Access;
+ Gpr_Prj_Path : String_Access;
+ Ada_Prj_Path : String_Access;
-- The path name(s) of directories where project files may reside.
-- May be empty.
-- If environment variables are defined and not empty, add their content
- Gpr_Prj_Path := Getenv (Gpr_Project_Path);
- Ada_Prj_Path := Getenv (Ada_Project_Path);
+ Gpr_Prj_Path_File := Getenv (Gpr_Project_Path_File);
+ Gpr_Prj_Path := Getenv (Gpr_Project_Path);
+ Ada_Prj_Path := Getenv (Ada_Project_Path);
+
+ if Gpr_Prj_Path_File.all /= "" then
+ declare
+ File : Ada.Text_IO.File_Type;
+ Line : String (1 .. 10_000);
+ Last : Natural;
+
+ Tmp : String_Access;
+
+ begin
+ Open (File, In_File, Gpr_Prj_Path_File.all);
+
+ while not End_Of_File (File) loop
+ Get_Line (File, Line, Last);
+
+ if Last /= 0
+ and then (Last = 1 or else Line (1 .. 2) /= "--")
+ then
+ Tmp := Self.Path;
+ Self.Path :=
+ new String'
+ (Tmp.all & Path_Separator & Line (1 .. Last));
+ Free (Tmp);
+ end if;
+
+ if Current_Verbosity = High then
+ Debug_Output ("Adding directory to Project_Path: """
+ & Line (1 .. Last) & '"');
+ end if;
+ end loop;
+
+ Close (File);
+
+ exception
+ when others =>
+ Write_Str ("warning: could not read project path file """);
+ Write_Str (Gpr_Prj_Path_File.all);
+ Write_Line ("""");
+ end;
+
+ end if;
if Gpr_Prj_Path.all /= "" then
Add_Directories (Self, Gpr_Prj_Path.all);