Fix for OpenIfExisting option for CreateFile
@@ -726,9 +726,15 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder::CreateFileNati
break;
case CreationCollisionOption_OpenIfExists:
- // Open existing file & truncate
+ if (fileExists)
+ {
+ // Open existing file
mode[0] = 'r';
- mode[1] = '+';
+ }
+ else
+ {
+ NANOCLR_SET_AND_LEAVE(CLR_E_FILE_NOT_FOUND);
+ }
break;
case CreationCollisionOption_GenerateUniqueName:
