with Exp_Tss; use Exp_Tss;
with Exp_Util; use Exp_Util;
with Expander; use Expander;
+with Fmap;
with Freeze; use Freeze;
with Ghost; use Ghost;
with Itypes; use Itypes;
with Nlists; use Nlists;
with Nmake; use Nmake;
with Opt; use Opt;
+with Osint;
with Restrict; use Restrict;
with Rident; use Rident;
with Rtsfind; use Rtsfind;
with Snames; use Snames;
with Stringt;
with Strub; use Strub;
+with System.OS_Lib;
with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Ttypes; use Ttypes;
Expr : N_Subexpr_Id;
+ Data_Path : File_Name_Type;
begin
Remove (Specification);
return;
end if;
+ declare
+ S : constant String := Stringt.To_String (Strval (Def));
begin
- declare
- Name : constant Valid_Name_Id :=
- Stringt.String_To_Name (Strval (Def));
+ if System.OS_Lib.Is_Absolute_Path (S) then
+ Data_Path := Name_Find (S);
+ else
+ declare
+ Current_File_Name : constant File_Name_Type :=
+ Unit_File_Name (Current_Sem_Unit);
+
+ Current_File_Path : constant File_Name_Type :=
+ Fmap.Mapped_Path_Name (Current_File_Name);
+
+ Current_File_Directory : constant File_Name_Type :=
+ Osint.Get_Directory (Current_File_Path);
+
+ Absolute_Dir : constant String :=
+ System.OS_Lib.Normalize_Pathname
+ (Get_Name_String (Current_File_Directory),
+ Resolve_Links => False);
+
+ Data_Path_String : constant String :=
+ Absolute_Dir
+ & System.OS_Lib.Directory_Separator
+ & Stringt.To_String (Strval (Def));
+ begin
+ Data_Path := Name_Find (Data_Path_String);
+ end;
+ end if;
+ end;
+
+ begin
+ declare
Source_File_I : constant Source_File_Index :=
- Sinput.L.Load_Source_File (File_Name_Type (Name));
+ Sinput.L.Load_Source_File (Data_Path);
begin
if Source_File_I <= No_Source_File then
Error_Msg_N ("cannot find input file", Specification);