Suppose I have the following function defined and used to check whether a required file is available based on the path provided to it.
bool check_my_file_exists( const std::wstring& my_root_file )
{
const std::wstring file_path = L"..\\..\\require_file.txt";
const std::wstring relative_path_to_required_file = my_root_file + L"\\" + file_path;
if ( !boost::filesystem::exists( relative_path_to_required_file ))
{
return false;
}
return true;
}
Suppose D:\my_file\require_file.txt exists and, when calling this function with following an absolute path to file as argument, it fails always
check_my_file_exists( L"D:\\my_files\\this_folder\\that_folder\\root.file" ); // return false
but when specifying absolute path to parent folder of root file as argument this works as expected,
check_my_file_exists( L"D:\\my_files\\this_folder\\that_folder" ); // return true
It is also possible to open the required_file.txt when using D:\my_files\this_folder\that_folder\root.file....\required_file.txt in explorer.
Environment:
- Boost : 1.69
- Visual Studio 2017
- Windows 10, 2004
I was confused about whether it was some boost implementation issue or expected behavior.