mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-08 09:26:11 +02:00
* make win32 compile
git-svn-id: trunk@5103 -
This commit is contained in:
parent
cb246eb781
commit
9f5d69ce31
@ -28,6 +28,12 @@ unit cfileutils;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
{$ifdef hasunix}
|
||||||
|
Baseunix,unix,
|
||||||
|
{$endif hasunix}
|
||||||
|
{$ifdef win32}
|
||||||
|
Windows,
|
||||||
|
{$endif win32}
|
||||||
{$IFNDEF USE_FAKE_SYSUTILS}
|
{$IFNDEF USE_FAKE_SYSUTILS}
|
||||||
SysUtils,
|
SysUtils,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
@ -88,10 +94,7 @@ interface
|
|||||||
Function PathExists ( F : String) : Boolean;
|
Function PathExists ( F : String) : Boolean;
|
||||||
Function FileExists ( Const F : String) : Boolean;
|
Function FileExists ( Const F : String) : Boolean;
|
||||||
function FileExistsNonCase(const path,fn:string;var foundfile:string):boolean;
|
function FileExistsNonCase(const path,fn:string;var foundfile:string):boolean;
|
||||||
Function RemoveFile(const f:string):boolean;
|
|
||||||
Function RemoveDir(d:string):boolean;
|
Function RemoveDir(d:string):boolean;
|
||||||
Function GetFileTime ( Var F : File) : Longint;
|
|
||||||
{Extracts the path without its filename, from a path.}
|
|
||||||
Function FixPath(s:string;allowdot:boolean):string;
|
Function FixPath(s:string;allowdot:boolean):string;
|
||||||
function FixFileName(const s:string):string;
|
function FixFileName(const s:string):string;
|
||||||
function TargetFixPath(s:string;allowdot:boolean):string;
|
function TargetFixPath(s:string;allowdot:boolean):string;
|
||||||
@ -109,9 +112,6 @@ interface
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
{$ifdef hasunix}
|
|
||||||
Baseunix,unix,
|
|
||||||
{$endif}
|
|
||||||
Comphook,
|
Comphook,
|
||||||
Globals;
|
Globals;
|
||||||
|
|
||||||
@ -435,18 +435,6 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function RemoveFile(const f:string):boolean;
|
|
||||||
var
|
|
||||||
g : file;
|
|
||||||
begin
|
|
||||||
assign(g,f);
|
|
||||||
{$I-}
|
|
||||||
erase(g);
|
|
||||||
{$I+}
|
|
||||||
RemoveFile:=(ioresult=0);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
Function RemoveDir(d:string):boolean;
|
Function RemoveDir(d:string):boolean;
|
||||||
begin
|
begin
|
||||||
if d[length(d)]=source_info.DirSep then
|
if d[length(d)]=source_info.DirSep then
|
||||||
@ -930,23 +918,6 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function GetFileTime ( Var F : File) : Longint;
|
|
||||||
Var
|
|
||||||
{$ifdef hasunix}
|
|
||||||
info: Stat;
|
|
||||||
{$endif}
|
|
||||||
L : longint;
|
|
||||||
begin
|
|
||||||
{$ifdef hasunix}
|
|
||||||
FPFStat (F,Info);
|
|
||||||
L:=Info.st_Mtime;
|
|
||||||
{$else}
|
|
||||||
GetFTime(f,l);
|
|
||||||
{$endif}
|
|
||||||
GetFileTime:=L;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
function FindFile(const f : string;path : string;var foundfile:string):boolean;
|
function FindFile(const f : string;path : string;var foundfile:string):boolean;
|
||||||
Var
|
Var
|
||||||
singlepathstring : string;
|
singlepathstring : string;
|
||||||
|
@ -513,7 +513,7 @@ implementation
|
|||||||
var
|
var
|
||||||
comspec : string;
|
comspec : string;
|
||||||
begin
|
begin
|
||||||
comspec:=getenv('COMSPEC');
|
comspec:=GetEnvironmentVariable('COMSPEC');
|
||||||
result := ExecuteProcess(comspec,' /C '+command);
|
result := ExecuteProcess(comspec,' /C '+command);
|
||||||
end;
|
end;
|
||||||
{$endif amigashell}
|
{$endif amigashell}
|
||||||
|
@ -666,7 +666,7 @@ Implementation
|
|||||||
begin
|
begin
|
||||||
MakeStaticLibrary:=false;
|
MakeStaticLibrary:=false;
|
||||||
{ remove the library, to be sure that it is rewritten }
|
{ remove the library, to be sure that it is rewritten }
|
||||||
RemoveFile(current_module.staticlibfilename^);
|
DeleteFile(current_module.staticlibfilename^);
|
||||||
{ Call AR }
|
{ Call AR }
|
||||||
smartpath:=current_module.outputpath^+FixPath(ChangeFileExt(current_module.asmfilename^,target_info.smartext),false);
|
smartpath:=current_module.outputpath^+FixPath(ChangeFileExt(current_module.asmfilename^,target_info.smartext),false);
|
||||||
SplitBinCmd(target_ar.arcmd,binstr,cmdstr);
|
SplitBinCmd(target_ar.arcmd,binstr,cmdstr);
|
||||||
@ -722,9 +722,9 @@ Implementation
|
|||||||
if not(cs_link_nolink in current_settings.globalswitches) then
|
if not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
begin
|
begin
|
||||||
while not SmartLinkOFiles.Empty do
|
while not SmartLinkOFiles.Empty do
|
||||||
RemoveFile(SmartLinkOFiles.GetFirst);
|
DeleteFile(SmartLinkOFiles.GetFirst);
|
||||||
if scripted_ar then
|
if scripted_ar then
|
||||||
RemoveFile(scriptfile);
|
DeleteFile(scriptfile);
|
||||||
RemoveDir(smartpath);
|
RemoveDir(smartpath);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -228,7 +228,7 @@ begin
|
|||||||
|
|
||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
|
|
||||||
MakeExecutable:=success; { otherwise a recursive call to link method }
|
MakeExecutable:=success; { otherwise a recursive call to link method }
|
||||||
end;
|
end;
|
||||||
|
@ -398,7 +398,7 @@ begin
|
|||||||
|
|
||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
|
|
||||||
MakeExecutable:=success; { otherwise a recursive call to link method }
|
MakeExecutable:=success; { otherwise a recursive call to link method }
|
||||||
end;
|
end;
|
||||||
@ -458,7 +458,7 @@ var
|
|||||||
|
|
||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
|
|
||||||
MakeSharedLibrary:=success; { otherwise a recursive call to link method }
|
MakeSharedLibrary:=success; { otherwise a recursive call to link method }
|
||||||
end;
|
end;
|
||||||
|
@ -548,7 +548,7 @@ begin
|
|||||||
|
|
||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
|
|
||||||
MakeExecutable:=success; { otherwise a recursive call to link method }
|
MakeExecutable:=success; { otherwise a recursive call to link method }
|
||||||
end;
|
end;
|
||||||
@ -599,7 +599,7 @@ begin
|
|||||||
|
|
||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
|
|
||||||
MakeSharedLibrary:=success; { otherwise a recursive call to link method }
|
MakeSharedLibrary:=success; { otherwise a recursive call to link method }
|
||||||
end;
|
end;
|
||||||
|
@ -513,7 +513,7 @@ begin
|
|||||||
|
|
||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
|
|
||||||
MakeExecutable:=success; { otherwise a recursive call to link method }
|
MakeExecutable:=success; { otherwise a recursive call to link method }
|
||||||
end;
|
end;
|
||||||
|
@ -541,7 +541,7 @@ begin
|
|||||||
|
|
||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
|
|
||||||
{ Post process }
|
{ Post process }
|
||||||
if success then
|
if success then
|
||||||
|
@ -264,8 +264,8 @@ begin
|
|||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
begin
|
begin
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
RemoveFile(outputexedir+Info.ScriptName);
|
DeleteFile(outputexedir+Info.ScriptName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
MakeExecutable:=success; { otherwise a recursive call to link method }
|
MakeExecutable:=success; { otherwise a recursive call to link method }
|
||||||
|
@ -640,7 +640,7 @@ begin
|
|||||||
|
|
||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
|
|
||||||
if (success) then
|
if (success) then
|
||||||
success:=PostProcessExecutable(current_module.exefilename^,false);
|
success:=PostProcessExecutable(current_module.exefilename^,false);
|
||||||
@ -693,7 +693,7 @@ begin
|
|||||||
|
|
||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
|
|
||||||
MakeSharedLibrary:=success; { otherwise a recursive call to link method }
|
MakeSharedLibrary:=success; { otherwise a recursive call to link method }
|
||||||
end;
|
end;
|
||||||
|
@ -233,7 +233,7 @@ begin
|
|||||||
|
|
||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
|
|
||||||
MakeExecutable:=success; { otherwise a recursive call to link method }
|
MakeExecutable:=success; { otherwise a recursive call to link method }
|
||||||
end;
|
end;
|
||||||
|
@ -252,7 +252,7 @@ begin
|
|||||||
|
|
||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
|
|
||||||
MakeExecutable:=success; { otherwise a recursive call to link method }
|
MakeExecutable:=success; { otherwise a recursive call to link method }
|
||||||
|
|
||||||
|
@ -581,7 +581,7 @@ begin
|
|||||||
|
|
||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
|
|
||||||
{ Call nlmconv }
|
{ Call nlmconv }
|
||||||
if success then
|
if success then
|
||||||
@ -594,11 +594,11 @@ begin
|
|||||||
success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
|
success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
begin
|
begin
|
||||||
RemoveFile(outputexedir+'n'+Info.ResName);
|
DeleteFile(outputexedir+'n'+Info.ResName);
|
||||||
RemoveFile(outputexedir+tmpLinkFileName);
|
DeleteFile(outputexedir+tmpLinkFileName);
|
||||||
if not xdcpresent then
|
if not xdcpresent then
|
||||||
if usexdc then
|
if usexdc then
|
||||||
RemoveFile (xdcname);
|
DeleteFile (xdcname);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -92,6 +92,7 @@ interface
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
SysUtils,
|
||||||
cutils,cfileutils,
|
cutils,cfileutils,
|
||||||
verbose,systems,globtype,globals,
|
verbose,systems,globtype,globals,
|
||||||
symconst,script,
|
symconst,script,
|
||||||
@ -524,7 +525,7 @@ begin
|
|||||||
|
|
||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
|
|
||||||
{ Call nlmconv }
|
{ Call nlmconv }
|
||||||
if success then
|
if success then
|
||||||
@ -537,8 +538,8 @@ begin
|
|||||||
success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
|
success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
begin
|
begin
|
||||||
RemoveFile(outputexedir+'n'+Info.ResName);
|
DeleteFile(outputexedir+'n'+Info.ResName);
|
||||||
RemoveFile(outputexedir+tmpLinkFileName);
|
DeleteFile(outputexedir+tmpLinkFileName);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -511,7 +511,7 @@ begin
|
|||||||
|
|
||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
|
|
||||||
MakeExecutable:=success; { otherwise a recursive call to link method }
|
MakeExecutable:=success; { otherwise a recursive call to link method }
|
||||||
end;
|
end;
|
||||||
|
@ -195,7 +195,7 @@ begin
|
|||||||
|
|
||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
|
|
||||||
MakeExecutable:=success; { otherwise a recursive call to link method }
|
MakeExecutable:=success; { otherwise a recursive call to link method }
|
||||||
end;
|
end;
|
||||||
|
@ -407,7 +407,7 @@ begin
|
|||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
{$IFNDEF LinkTest}
|
{$IFNDEF LinkTest}
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
MakeExecutable:=success; { otherwise a recursive call to link method }
|
MakeExecutable:=success; { otherwise a recursive call to link method }
|
||||||
end;
|
end;
|
||||||
@ -444,7 +444,7 @@ begin
|
|||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
{$IFNDEF LinkTest}
|
{$IFNDEF LinkTest}
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
MakeSharedLibrary:=success; { otherwise a recursive call to link method }
|
MakeSharedLibrary:=success; { otherwise a recursive call to link method }
|
||||||
end;
|
end;
|
||||||
|
@ -159,7 +159,7 @@ begin
|
|||||||
|
|
||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
|
|
||||||
MakeExecutable:=success; { otherwise a recursive call to link method }
|
MakeExecutable:=success; { otherwise a recursive call to link method }
|
||||||
end;
|
end;
|
||||||
|
@ -1330,10 +1330,10 @@ implementation
|
|||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
begin
|
begin
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
RemoveFile('base.$$$');
|
DeleteFile('base.$$$');
|
||||||
RemoveFile('exp.$$$');
|
DeleteFile('exp.$$$');
|
||||||
RemoveFile('deffile.$$$');
|
DeleteFile('deffile.$$$');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
MakeExecutable:=success; { otherwise a recursive call to link method }
|
MakeExecutable:=success; { otherwise a recursive call to link method }
|
||||||
@ -1432,10 +1432,10 @@ implementation
|
|||||||
{ Remove ReponseFile }
|
{ Remove ReponseFile }
|
||||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||||
begin
|
begin
|
||||||
RemoveFile(outputexedir+Info.ResName);
|
DeleteFile(outputexedir+Info.ResName);
|
||||||
RemoveFile('base.$$$');
|
DeleteFile('base.$$$');
|
||||||
RemoveFile('exp.$$$');
|
DeleteFile('exp.$$$');
|
||||||
RemoveFile('deffile.$$$');
|
DeleteFile('deffile.$$$');
|
||||||
end;
|
end;
|
||||||
MakeSharedLibrary:=success; { otherwise a recursive call to link method }
|
MakeSharedLibrary:=success; { otherwise a recursive call to link method }
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user