From 9f5d69ce31ad0799d030840e84a6324dc319dc0a Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 30 Oct 2006 23:46:28 +0000 Subject: [PATCH] * make win32 compile git-svn-id: trunk@5103 - --- compiler/cfileutils.pas | 41 +++++------------------------------ compiler/globals.pas | 2 +- compiler/link.pas | 6 ++--- compiler/systems/t_amiga.pas | 2 +- compiler/systems/t_beos.pas | 4 ++-- compiler/systems/t_bsd.pas | 4 ++-- compiler/systems/t_emx.pas | 2 +- compiler/systems/t_gba.pas | 2 +- compiler/systems/t_go32v2.pas | 4 ++-- compiler/systems/t_linux.pas | 4 ++-- compiler/systems/t_macos.pas | 2 +- compiler/systems/t_morph.pas | 2 +- compiler/systems/t_nwl.pas | 8 +++---- compiler/systems/t_nwm.pas | 7 +++--- compiler/systems/t_os2.pas | 2 +- compiler/systems/t_palmos.pas | 2 +- compiler/systems/t_sunos.pas | 4 ++-- compiler/systems/t_watcom.pas | 2 +- compiler/systems/t_win.pas | 16 +++++++------- 19 files changed, 44 insertions(+), 72 deletions(-) diff --git a/compiler/cfileutils.pas b/compiler/cfileutils.pas index f79da75c54..45c4862ee4 100644 --- a/compiler/cfileutils.pas +++ b/compiler/cfileutils.pas @@ -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; diff --git a/compiler/globals.pas b/compiler/globals.pas index f4ca3f0ddd..fd9d6a8cff 100644 --- a/compiler/globals.pas +++ b/compiler/globals.pas @@ -513,7 +513,7 @@ implementation var comspec : string; begin - comspec:=getenv('COMSPEC'); + comspec:=GetEnvironmentVariable('COMSPEC'); result := ExecuteProcess(comspec,' /C '+command); end; {$endif amigashell} diff --git a/compiler/link.pas b/compiler/link.pas index b7da4816fe..8acb152fcb 100644 --- a/compiler/link.pas +++ b/compiler/link.pas @@ -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 diff --git a/compiler/systems/t_amiga.pas b/compiler/systems/t_amiga.pas index 2014439c7e..243739cac9 100644 --- a/compiler/systems/t_amiga.pas +++ b/compiler/systems/t_amiga.pas @@ -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; diff --git a/compiler/systems/t_beos.pas b/compiler/systems/t_beos.pas index 5d53d4a4b5..a32f00eec1 100644 --- a/compiler/systems/t_beos.pas +++ b/compiler/systems/t_beos.pas @@ -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; diff --git a/compiler/systems/t_bsd.pas b/compiler/systems/t_bsd.pas index 0bc8905af1..32c96e11de 100644 --- a/compiler/systems/t_bsd.pas +++ b/compiler/systems/t_bsd.pas @@ -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; diff --git a/compiler/systems/t_emx.pas b/compiler/systems/t_emx.pas index 7628dcd94a..cd4e87dbcd 100644 --- a/compiler/systems/t_emx.pas +++ b/compiler/systems/t_emx.pas @@ -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; diff --git a/compiler/systems/t_gba.pas b/compiler/systems/t_gba.pas index 2e682f326d..886d1120c7 100644 --- a/compiler/systems/t_gba.pas +++ b/compiler/systems/t_gba.pas @@ -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 diff --git a/compiler/systems/t_go32v2.pas b/compiler/systems/t_go32v2.pas index 8229b99dd5..cbd22a5e60 100644 --- a/compiler/systems/t_go32v2.pas +++ b/compiler/systems/t_go32v2.pas @@ -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 } diff --git a/compiler/systems/t_linux.pas b/compiler/systems/t_linux.pas index a98e322986..9f2f505baf 100644 --- a/compiler/systems/t_linux.pas +++ b/compiler/systems/t_linux.pas @@ -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; diff --git a/compiler/systems/t_macos.pas b/compiler/systems/t_macos.pas index 2738f72dcb..eeddd41462 100644 --- a/compiler/systems/t_macos.pas +++ b/compiler/systems/t_macos.pas @@ -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; diff --git a/compiler/systems/t_morph.pas b/compiler/systems/t_morph.pas index 9b1a5ed83e..90f8582876 100644 --- a/compiler/systems/t_morph.pas +++ b/compiler/systems/t_morph.pas @@ -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 } diff --git a/compiler/systems/t_nwl.pas b/compiler/systems/t_nwl.pas index c3635fe080..2eb83f89f3 100644 --- a/compiler/systems/t_nwl.pas +++ b/compiler/systems/t_nwl.pas @@ -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; diff --git a/compiler/systems/t_nwm.pas b/compiler/systems/t_nwm.pas index 1409b87d48..dd3cb6924d 100644 --- a/compiler/systems/t_nwm.pas +++ b/compiler/systems/t_nwm.pas @@ -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; diff --git a/compiler/systems/t_os2.pas b/compiler/systems/t_os2.pas index 2e675ea7d2..377da7a7c2 100644 --- a/compiler/systems/t_os2.pas +++ b/compiler/systems/t_os2.pas @@ -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; diff --git a/compiler/systems/t_palmos.pas b/compiler/systems/t_palmos.pas index 93206ec9f2..e02f88b2ac 100644 --- a/compiler/systems/t_palmos.pas +++ b/compiler/systems/t_palmos.pas @@ -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; diff --git a/compiler/systems/t_sunos.pas b/compiler/systems/t_sunos.pas index ddb42a8397..57c528954b 100644 --- a/compiler/systems/t_sunos.pas +++ b/compiler/systems/t_sunos.pas @@ -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; diff --git a/compiler/systems/t_watcom.pas b/compiler/systems/t_watcom.pas index 3f4b52e00f..642eccb049 100644 --- a/compiler/systems/t_watcom.pas +++ b/compiler/systems/t_watcom.pas @@ -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; diff --git a/compiler/systems/t_win.pas b/compiler/systems/t_win.pas index cf9af4d8e6..d13bca3abb 100644 --- a/compiler/systems/t_win.pas +++ b/compiler/systems/t_win.pas @@ -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;