From 72b2f07ccac7578ef36fc2b92dcba49abe397ebc Mon Sep 17 00:00:00 2001 From: Damjan Jovanovic Date: Tue, 3 Nov 2015 19:09:04 +0000 Subject: #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. --- basic/source/runtime/iosys.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'basic') diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index 70c24382183e..f404c2a9f59f 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -665,7 +665,7 @@ SbError SbiStream::Open { // #??? For write access delete file if it already exists (not for appending) - if( (nStrmMode & STREAM_WRITE) != 0 && !IsAppend() && !IsBinary() && + if( (nStrmMode & STREAM_WRITE) != 0 && !IsAppend() && !IsBinary() && !IsRandom() && xSFI->exists( aNameStr ) && !xSFI->isFolder( aNameStr ) ) { xSFI->kill( aNameStr ); -- cgit