Skip to content

Commit

Permalink
Don't fail on file_not_found if that's what you're checking for
Browse files Browse the repository at this point in the history
  • Loading branch information
AI0867 committed Apr 9, 2014
1 parent d2590b0 commit a6633c8
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/filesystem_boost.cpp
Expand Up @@ -118,7 +118,12 @@ static bool create_directory_if_missing(const path &dirpath)
{
error_code ec;
bfs::file_status fs = bfs::status(dirpath, ec);
if (ec) {
if (ec
&& ec.value() != boost::system::errc::no_such_file_or_directory
#ifdef _WIN32
&& ec.value() != boost::system::windows_error::path_not_found
#endif /*_WIN32*/
) {
ERR_FS << "Failed to retrieve file status for " << dirpath.string() << ": " << ec.message() << '\n';
return false;
} else if (bfs::is_directory(fs)) {
Expand All @@ -143,7 +148,12 @@ static bool create_directory_if_missing_recursive(const path& dirpath)
return false;
error_code ec;
bfs::file_status fs = bfs::status(dirpath);
if (ec) {
if (ec
&& ec.value() != boost::system::errc::no_such_file_or_directory
#ifdef _WIN32
&& ec.value() != boost::system::windows_error::path_not_found
#endif /*_WIN32*/
) {
ERR_FS << "Failed to retrieve file status for " << dirpath.string() << ": " << ec.message() << '\n';
return false;
} else if (bfs::is_directory(fs)) {
Expand Down Expand Up @@ -232,7 +242,12 @@ void get_files_in_dir(const std::string &dir,

const path inner_main(di->path() / maincfg_filename);
bfs::file_status main_st = bfs::status(inner_main, ec);
if (ec && ec.value() != boost::system::errc::no_such_file_or_directory) {
if (ec
&& ec.value() != boost::system::errc::no_such_file_or_directory
#ifdef _WIN32
&& ec.value() != boost::system::windows_error::path_not_found
#endif /*_WIN32*/
) {
ERR_FS << "Failed to get file status of " << inner_main.string() << ": " << ec.message() << '\n';
} else if (reorder == DO_REORDER && main_st.type() == bfs::regular_file) {
LOG_FS << "_main.cfg found : " << (mode == ENTIRE_FILE_PATH ? inner_main.string() : inner_main.filename().string()) << '\n';
Expand Down

0 comments on commit a6633c8

Please sign in to comment.