From e60a542c457b993a752748dddc811089edd1eed7 Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Sun, 2 Oct 2011 00:45:20 +0200 Subject: [PATCH] Filewall can now hook into DeleteFile. --- Units/MMLAddon/PSInc/Wrappers/file.inc | 2 +- Units/MMLCore/files.pas | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Units/MMLAddon/PSInc/Wrappers/file.inc b/Units/MMLAddon/PSInc/Wrappers/file.inc index ff88571..60b6579 100644 --- a/Units/MMLAddon/PSInc/Wrappers/file.inc +++ b/Units/MMLAddon/PSInc/Wrappers/file.inc @@ -103,7 +103,7 @@ end; function ps_DeleteFile(const Filename: string): Boolean; extdecl; begin - Result := DeleteFileUTF8(Filename); + Result := CurrThread.Client.MFiles.DeleteFile(Filename); end; procedure ps_WriteINI(const Section, KeyName, NewString, FileName: string);extdecl; diff --git a/Units/MMLCore/files.pas b/Units/MMLCore/files.pas index 18d2aaf..06d0d9b 100644 --- a/Units/MMLCore/files.pas +++ b/Units/MMLCore/files.pas @@ -45,6 +45,7 @@ type function OpenFile(Path: string; Shared: Boolean): Integer; function RewriteFile(Path: string; Shared: Boolean): Integer; function AppendFile(Path: string): Integer; + function DeleteFile(Filename: string): Boolean; procedure CloseFile(FileNum: Integer); function EndOfFile(FileNum: Integer): Boolean; function FileSizeMuf(FileNum: Integer): LongInt; @@ -334,6 +335,21 @@ begin end; end; + +function TMFiles.DeleteFile(Filename: string): Boolean; +var + Continue : Boolean; +begin + if Assigned(WriteFileEvent) then + begin; + Continue := true; + WriteFileEvent(Self, Filename, continue); + if not Continue then + exit(False); + end; + Result := DeleteFileUTF8(Filename); +end; + {/\ Free's the given File at the given index. /\}