Resolves: #i61277# Basic open file with random access erases all data.
StarBasic tries to emulate truncation of files opened for writing by deleting them before opening them (if they exist). However there are exclusion to the truncation behaviour when the file is opened in append mode or is a binary file. Another exclusion - that was missing with disasterous consequences - is that the file should not be truncated when opened in random access mode. (cherry picked from commit 72b2f07ccac7578ef36fc2b92dcba49abe397ebc) Change-Id: Ic0053039ce5fd67ad42bf5332ae301d83f1a158d
This commit is contained in:
committed by
Caolán McNamara
parent
d4d4e00a5a
commit
42a63dd0e8
@@ -582,7 +582,7 @@ SbError SbiStream::Open
|
||||
{
|
||||
|
||||
// #??? For write access delete file if it already exists (not for appending)
|
||||
if( (nStrmMode & StreamMode::WRITE) && !IsAppend() && !IsBinary() &&
|
||||
if( (nStrmMode & StreamMode::WRITE) && !IsAppend() && !IsBinary() && !IsRandom() &&
|
||||
xSFI->exists( aNameStr ) && !xSFI->isFolder( aNameStr ) )
|
||||
{
|
||||
xSFI->kill( aNameStr );
|
||||
|
Reference in New Issue
Block a user