Opened 5 years ago

#13484 new Bugs

exists doesn't clear no_such_file_or_directory type of error codes

Reported by: Alex Weiss <alexweiss86@…> Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.66.0 Severity: Problem
Keywords: exists error_code Cc:

Description

Windows 10, MSVC 19.13.26128.

exists() fails when it successfully determines that a file doesn't exist (i.e. it sets the error code to ERROR_FILE_NOT_FOUND or throws in the throwing version). According to the reference and the tutorial example, that should not happen.

Code example:

        boost::filesystem::path p("c:\\filethatdoesntexist");
	boost::system::error_code ec;
	bool doesExist = boost::filesystem::exists(p, ec);
	if (ec == boost::system::errc::no_such_file_or_directory) {
		std::cout << "shouldn't happen!\n";
	}

Note that for existing files, exists() works as expected.

Change History (0)

Note: See TracTickets for help on using tickets.