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

@ -44,6 +44,9 @@
<UseExternalDbgSyms Value="True"/>
</Debugging>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</Item2>
<Item3 Name="Release">
@ -71,6 +74,9 @@
</Debugging>
<LinkSmart Value="True"/>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</Item3>
</BuildModes>
@ -115,5 +121,8 @@
<DebugInfoType Value="dsDwarf2Set"/>
</Debugging>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</CONFIG>

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);

View File

@ -14,6 +14,9 @@ unit fpspreadsheet;
interface
uses
{$IFDEF UNIX}
clocale,
{$ENDIF}
Classes, SysUtils, fpimage, AVL_Tree, avglvltree, lconvencoding;
type
@ -1094,9 +1097,6 @@ procedure InitCell(var ACell: TCell);
implementation
uses
{$IFDEF UNIX}
clocale,
{$ENDIF}
Math, StrUtils, TypInfo, fpsStreams, fpsUtils, fpsNumFormatParser, fpsFunc;
{ Translatable strings }