WIN map ERROR_DIRECTORY to osl_File_E_NOTDIR

The open_004 unit test fails on Windows with E_NOENT. I think the
assert is correct, and it's better change the ERROR_DIRECTORY
mapping, as FindFirstFileW returns ERROR_PATH_NOT_FOUND, if the
path doesn't exists at all.

The description of that error code in the MS API docs is "The
directory name is invalid.". And obviously there is no way to
tell, if this is actually a better mapping.

Change-Id: Id122ce39e90f3562e70c96a06752e5b32ed55b41
Reviewed-on: https://gerrit.libreoffice.org/84070
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
This commit is contained in:
Jan-Marek Glogowski
2019-11-29 16:07:55 +01:00
committed by Jan-Marek Glogowski
parent 5a77636c9a
commit c6553564a8
2 changed files with 1 additions and 3 deletions

View File

@@ -77,7 +77,7 @@ static const struct osl_file_error_entry errtable[] = {
{ ERROR_FILENAME_EXCED_RANGE, osl_File_E_NOENT }, /* 206 */
{ ERROR_NESTING_NOT_ALLOWED, osl_File_E_AGAIN }, /* 215 */
{ ERROR_FILE_CHECKED_OUT, osl_File_E_ACCES }, /* 220 */
{ ERROR_DIRECTORY, osl_File_E_NOENT }, /* 267 */
{ ERROR_DIRECTORY, osl_File_E_NOTDIR }, /* 267 */
{ ERROR_NOT_ENOUGH_QUOTA, osl_File_E_NOMEM }, /* 1816 */
{ ERROR_CANT_ACCESS_FILE, osl_File_E_ACCES }, /* 1920 */
{ ERROR_UNEXP_NET_ERR, osl_File_E_NETWORK } /* 59 */

View File

@@ -4142,10 +4142,8 @@ namespace osl_Directory
CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, nError2);
}
#ifndef _WIN32 // returns E_NOENT on Windows
CPPUNIT_ASSERT_MESSAGE("test for open function: open a file instead of a directory",
(osl::FileBase::E_NOTDIR == nError1) || (osl::FileBase::E_ACCES == nError1));
#endif
}
CPPUNIT_TEST_SUITE(open);