diff options
| author | florian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2011-04-10 19:20:48 +0000 |
|---|---|---|
| committer | florian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2011-04-10 19:20:48 +0000 |
| commit | 160cc1e115eeb75638dce6effdd16b2bc810ddb4 (patch) | |
| tree | b791a95695a7cf674e61a6153139c6f9c6c491fa /packages/fcl-base | |
| parent | 3843727e74b31bbf2a34e7e3b89ee422269f770e (diff) | |
| parent | 413a6aa6469e6c297780217a27ca91363c637944 (diff) | |
| download | fpc-160cc1e115eeb75638dce6effdd16b2bc810ddb4.tar.gz | |
* rebase to trunk@17295avr
git-svn-id: http://svn.freepascal.org/svn/fpc/branches/avr@17296 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/fcl-base')
| -rw-r--r-- | packages/fcl-base/src/eventlog.pp | 13 | ||||
| -rw-r--r-- | packages/fcl-base/src/inifiles.pp | 6 |
2 files changed, 16 insertions, 3 deletions
diff --git a/packages/fcl-base/src/eventlog.pp b/packages/fcl-base/src/eventlog.pp index 00c679abb4..d17d5881f5 100644 --- a/packages/fcl-base/src/eventlog.pp +++ b/packages/fcl-base/src/eventlog.pp @@ -29,6 +29,7 @@ Type TEventLog = Class(TComponent) Private + fAppendContent : Boolean; FEventIDOffset : DWord; FLogHandle : Pointer; FStream : TFileStream; @@ -84,6 +85,7 @@ Type Procedure Info (const Msg : String); {$ifndef fpc }Overload;{$endif} Procedure Info (const Fmt : String; Args : Array of const); {$ifndef fpc }Overload;{$endif} Published + Property AppendContent : Boolean Read fAppendContent Write fAppendContent; Property Identification : String Read FIdentification Write SetIdentification; Property LogType : TLogType Read Flogtype Write SetlogType; Property Active : Boolean Read FActive write SetActive; @@ -240,12 +242,19 @@ begin end; Procedure TEventLog.ActivateFileLog; - +var + fFileFlags : Word; begin If (FFileName='') then FFileName:=DefaultFileName; // This will raise an exception if the file cannot be opened for writing ! - FStream:=TFileStream.Create(FFileName,fmCreate or fmShareDenyWrite); + if fAppendContent and FileExists(FFileName) then + fFileFlags := fmOpenWrite + else + fFileFlags := fmCreate; + + fFileFlags := fFileFlags or fmShareDenyWrite; + FStream:=TFileStream.Create(FFileName,fFileFlags); end; Procedure TEventLog.DeActivateFileLog; diff --git a/packages/fcl-base/src/inifiles.pp b/packages/fcl-base/src/inifiles.pp index eb4164bc1b..f75416d5e9 100644 --- a/packages/fcl-base/src/inifiles.pp +++ b/packages/fcl-base/src/inifiles.pp @@ -657,7 +657,11 @@ end; destructor TIniFile.destroy; begin If FDirty and FCacheUpdates then - UpdateFile; + try + UpdateFile; + except + // Eat exception. Compatible to D7 behaviour, see comments to bug 19046 + end; inherited destroy; end; |
