diff --git a/stl/src/filesystem.cpp b/stl/src/filesystem.cpp index 8a083af2e..4f81e4042 100644 --- a/stl/src/filesystem.cpp +++ b/stl/src/filesystem.cpp @@ -657,11 +657,15 @@ __std_win_error __stdcall __std_fs_get_file_id(__std_fs_file_id* const _Id, cons } _Last_error = __std_win_error{GetLastError()}; - if (_Last_error != __std_win_error::_Invalid_parameter && _Last_error != __std_win_error::_Invalid_function) { + switch (_Last_error) { + case __std_win_error::_Invalid_parameter: // Older Windows versions + case __std_win_error::_Invalid_function: // Windows 10 1607 + case __std_win_error::_Not_supported: // POSIX delete not supported by the file system + break; // try non-POSIX delete below + default: return {false, _Last_error}; } - // Filesystem without POSIX delete support, or older than Windows 10 RS1 version without such support: FILE_DISPOSITION_INFO _Info{/* .Delete= */ TRUE}; if (_SetFileInformationByHandle(_Handle._Get(), FileDispositionInfo, &_Info, sizeof(_Info))) { return {true, __std_win_error::_Success};