-- Relative_Path --
-------------------
- function Relative_Path (Pathname, To : String) return String is
-
+ function Relative_Path (Pathname : String; To : String) return String is
function Ensure_Directory (Path : String) return String;
+ -- Function spec must be commented ???
----------------------
-- Ensure_Directory --
end if;
end Ensure_Directory;
+ -- Local variables
+
Dir_Sep_Map : constant Character_Mapping := To_Mapping ("\", "/");
P : String (1 .. Pathname'Length) := Pathname;
Pi : Natural; -- common prefix ending
N : Natural := 0;
+ -- Start of processing for Relative_Path
+
begin
pragma Assert (Is_Absolute_Path (Pathname));
pragma Assert (Is_Absolute_Path (To));
-- corresponding number of "..".
N := Count (T (Pi + 1 .. T'Last), "/");
+
if T (T'Last) /= '/' then
N := N + 1;
end if;
Last := Last - 1;
end loop;
- -- If we do not find a separator, we output the maximum length
- -- possible.
+ -- If we do not find a separator, output maximum length possible
if Last < First then
Last := First + Max_Length - Positive (Column);
-- are handled. This routine must be called only when the project has
-- been built successfully.
- function Relative_Path (Pathname, To : String) return String;
+ function Relative_Path (Pathname : String; To : String) return String;
-- Returns the relative pathname which corresponds to Pathname when
-- starting from directory to. Both Pathname and To must be absolute paths.