From 50eb70943914b0da416a7423ddf42eb9076ed2f8 Mon Sep 17 00:00:00 2001 From: "Ignacio R. Morelle" Date: Tue, 23 Dec 2014 22:46:36 -0300 Subject: [PATCH] fs: Quietly ignore non-dir targets in get_files_in_dir() (BFS only) 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. --- src/filesystem.cpp | 1 + src/filesystem_boost.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/filesystem.cpp b/src/filesystem.cpp index 46ff779e9927..468ea78af850 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -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; } diff --git a/src/filesystem_boost.cpp b/src/filesystem_boost.cpp index 22d5541060a2..bc0b5d8bce2c 100644 --- a/src/filesystem_boost.cpp +++ b/src/filesystem_boost.cpp @@ -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) {