summaryrefslogtreecommitdiff
path: root/src/ghdldrv/ghdllocal.adb
diff options
context:
space:
mode:
authorTristan Gingold2015-06-09 02:50:40 +0200
committerTristan Gingold2015-06-09 02:50:40 +0200
commitbfabdb8c6dff4431c4d24f7d6a2eda0faaa0154f (patch)
treed7bcbbc1bb2f6fcc900a2d4affec4195c76f8d60 /src/ghdldrv/ghdllocal.adb
parenta9ec8b7775d64fc5acec0da1e0016a37bc8b44fa (diff)
downloadghdl-bfabdb8c6dff4431c4d24f7d6a2eda0faaa0154f.tar.gz
ghdl-bfabdb8c6dff4431c4d24f7d6a2eda0faaa0154f.tar.bz2
ghdl-bfabdb8c6dff4431c4d24f7d6a2eda0faaa0154f.zip
ghdldrv: compile elab file in output directory.
Ticket 87.
Diffstat (limited to 'src/ghdldrv/ghdllocal.adb')
-rw-r--r--src/ghdldrv/ghdllocal.adb20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/ghdldrv/ghdllocal.adb b/src/ghdldrv/ghdllocal.adb
index 8e2eceb..8419715 100644
--- a/src/ghdldrv/ghdllocal.adb
+++ b/src/ghdldrv/ghdllocal.adb
@@ -182,7 +182,7 @@ package body Ghdllocal is
return I;
end if;
end loop;
- return 0;
+ return Pathname'First - 1;
end Get_Basename_Pos;
-- Simple lower case conversion, used to compare with "bin".
@@ -207,7 +207,7 @@ package body Ghdllocal is
Last : Natural;
begin
Last := Get_Basename_Pos (Prog_Path);
- if Last = 0 then
+ if Last < Prog_Path'First then
-- No directory in Prog_Path. This is not expected.
return;
end if;
@@ -225,7 +225,7 @@ package body Ghdllocal is
-- Skip executable name
Last := Get_Basename_Pos (Pathname);
- if Last = 0 then
+ if Last < Pathname'First then
return;
end if;
@@ -297,7 +297,7 @@ package body Ghdllocal is
-- Skip '/bin' directory if present
Pos := Get_Basename_Pos (Pathname (Pathname'First .. Last));
- if Pos = 0 then
+ if Pos < Pathname'First then
return;
end if;
if To_Lower (Pathname (Pos + 1 .. Last)) = "bin" then
@@ -323,7 +323,7 @@ package body Ghdllocal is
-- If the command name is a relative path, deduce prefix from it
-- and current path.
- if Get_Basename_Pos (Prog_Path) /= 0 then
+ if Get_Basename_Pos (Prog_Path) >= Prog_Path'First then
if Is_Executable_File (Prog_Path) then
Set_Prefix_From_Program_Path
(Get_Current_Dir & Directory_Separator & Prog_Path);
@@ -559,12 +559,18 @@ package body Ghdllocal is
return Filename (First .. Last);
end Get_Base_Name;
- function Append_Suffix (File : String; Suffix : String) return String_Access
+ function Append_Suffix
+ (File : String; Suffix : String; In_Work : Boolean := True)
+ return String_Access
is
use Name_Table;
Basename : constant String := Get_Base_Name (File);
begin
- Image (Libraries.Work_Directory);
+ if In_Work then
+ Image (Libraries.Work_Directory);
+ else
+ Nam_Length := Nam_Buffer'First - 1;
+ end if;
Nam_Buffer (Nam_Length + 1 .. Nam_Length + Basename'Length) :=
Basename;
Nam_Length := Nam_Length + Basename'Length;