From b9857e9f71f18fab88dc3f71bf6e1ecff6433013 Mon Sep 17 00:00:00 2001 From: Adrian Soundy Date: Sun, 12 May 2019 18:06:49 +1200 Subject: [PATCH] Fix issue 447 --- ...torage_native_Windows_Storage_StorageFolder.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/targets/FreeRTOS_ESP32/ESP32_WROOM_32/nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_StorageFolder.cpp b/targets/FreeRTOS_ESP32/ESP32_WROOM_32/nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_StorageFolder.cpp index 7d88a48543..8700b048a9 100644 --- a/targets/FreeRTOS_ESP32/ESP32_WROOM_32/nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_StorageFolder.cpp +++ b/targets/FreeRTOS_ESP32/ESP32_WROOM_32/nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_StorageFolder.cpp @@ -726,10 +726,16 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder::CreateFileNati break; case CreationCollisionOption_OpenIfExists: - // Open existing file & truncate - mode[0] = 'r'; - mode[1] = '+'; - break; + if (fileExists) + { + // Open existing file + mode[0] = 'r'; + } + else + { + NANOCLR_SET_AND_LEAVE(CLR_E_FILE_NOT_FOUND); + } + break; case CreationCollisionOption_GenerateUniqueName: // this operation is not supported in nanoFramework