From 2038620bc42c6d5c82f4993994717d02b0b53492 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 2 Sep 2019 20:15:52 +0200 Subject: [PATCH] db/simple/Directory: add method IsReallyAFile() --- src/db/plugins/simple/Directory.hxx | 9 +++++++++ src/db/update/UpdateIO.cxx | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/db/plugins/simple/Directory.hxx b/src/db/plugins/simple/Directory.hxx index 540cfec3c..8c6924a35 100644 --- a/src/db/plugins/simple/Directory.hxx +++ b/src/db/plugins/simple/Directory.hxx @@ -111,6 +111,15 @@ public: return new Directory(std::string(), nullptr); } + /** + * Is this really a regular file which is being treated like a + * directory? + */ + bool IsReallyAFile() const noexcept { + return device == DEVICE_INARCHIVE || + device == DEVICE_CONTAINER; + } + bool IsMount() const noexcept { return mounted_database != nullptr; } diff --git a/src/db/update/UpdateIO.cxx b/src/db/update/UpdateIO.cxx index d79e50f4a..b9cde8e0c 100644 --- a/src/db/update/UpdateIO.cxx +++ b/src/db/update/UpdateIO.cxx @@ -59,8 +59,7 @@ DirectoryExists(Storage &storage, const Directory &directory) noexcept return false; } - return directory.device == DEVICE_INARCHIVE || - directory.device == DEVICE_CONTAINER + return directory.IsReallyAFile() ? info.IsRegular() : info.IsDirectory(); }