Skip to content

Commit

Permalink
fs: Quietly ignore non-dir targets in get_files_in_dir() (BFS only)
Browse files Browse the repository at this point in the history
The non-BFS implementation already ignored this case without making
noise in stderr, and this function is used by delete_directory(), which
also accepts both regular files and directories. The add-ons management
code has always relied on this behavior.
  • Loading branch information
irydacea committed Dec 24, 2014
1 parent 2c675a8 commit 50eb709
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/filesystem.cpp
Expand Up @@ -138,6 +138,7 @@ void get_files_in_dir(const std::string &directory,
DIR* dir = opendir(directory.c_str());

if(dir == NULL) {
// Probably not a directory, let the caller deal with it.
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/filesystem_boost.cpp
Expand Up @@ -335,7 +335,7 @@ void get_files_in_dir(const std::string &dir,
bfs::directory_iterator di(dirpath, ec);
bfs::directory_iterator end;
if (ec) {
ERR_FS << "Failed to open directory " << dirpath.string() << ": " << ec.message() << '\n';
// Probably not a directory, let the caller deal with it.
return;
}
for(; di != end; ++di) {
Expand Down

0 comments on commit 50eb709

Please sign in to comment.