Fix binary dir determination for mingw/msc.

This commit is contained in:
David Brown 2016-12-18 17:12:00 +00:00
parent fc385eca3c
commit 7386767d84
2 changed files with 5 additions and 4 deletions

View file

@ -74,6 +74,7 @@ MODULE Modules; (* jt 6.1.96 *)
RETURN i RETURN i
END ArgPos; END ArgPos;
(* Determine directory from which this executable was loaded *) (* Determine directory from which this executable was loaded *)
PROCEDURE CharCount(s: ARRAY OF CHAR): INTEGER; PROCEDURE CharCount(s: ARRAY OF CHAR): INTEGER;
@ -151,7 +152,7 @@ MODULE Modules; (* jt 6.1.96 *)
END ExtractPart; END ExtractPart;
PROCEDURE Trim(s: ARRAY OF CHAR; VAR d: ARRAY OF CHAR); PROCEDURE Trim(s: ARRAY OF CHAR; VAR d: ARRAY OF CHAR);
(* Remove redundant '.'s and '/'s. (* Remove redundant '.'s and '/'s. Convert '\'s to '/'. *)
Note, does not remove 'x/..'. This cannot safely be removed because if Note, does not remove 'x/..'. This cannot safely be removed because if
x is a link then 'x/..' means the parent of what x links to rather than x is a link then 'x/..' means the parent of what x links to rather than
the directory containing link x. the directory containing link x.
@ -187,8 +188,8 @@ MODULE Modules; (* jt 6.1.96 *)
END; END;
GetArg(0, arg0); (* arg0 is the command binary file name passed by the shell. *) GetArg(0, arg0); (* arg0 is the command binary file name passed by the shell. *)
i := 0; WHILE (arg0[i] # 0X) & (arg0[i] # '/') DO INC(i) END; i := 0; WHILE (arg0[i] # 0X) & (arg0[i] # '/') & (arg0[i] # '\') DO INC(i) END;
IF arg0[i] = '/' THEN IF (arg0[i] = '/') OR (arg0[i] = '\') THEN
(* The argument contains a '/', we expect it to work without reference (* The argument contains a '/', we expect it to work without reference
to the path. *) to the path. *)
Trim(arg0, tempstr); Canonify(tempstr, binarydir); Trim(arg0, tempstr); Canonify(tempstr, binarydir);

View file

@ -1 +1 @@
18 Oct 2016 18:12:01 18 Dec 2016 16:55:53