fpspreadsheet: In fpolebasic manually delete an existing file before writing; this seems to fix a crash with Linux.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3367 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-07-23 21:09:47 +00:00
parent 6959ebb070
commit fce1ea9409
3 changed files with 18 additions and 4 deletions

View File

@ -57,7 +57,12 @@ var
tmpStream: TStream; // workaround to a compiler bug, see bug 22370
begin
VLAbsolutePath:='/'+AStreamName; //Virtual layer always use absolute paths.
if not AOverwriteExisting and FileExists(AFileName) then begin
if FileExists(AFileName) then begin
if AOverwriteExisting then
DeleteFile(AFileName)
// In Ubuntu is seems that fmCreate does not erase an existing file.
// Therefore we delete it manually.
else
Raise EStreamError.Createfmt('File "%s" already exists.',[AFileName]);
end;
RealFile:=TFileStream.Create(AFileName,fmCreate);