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