Commit 2038620b authored by Max Kellermann's avatar Max Kellermann

db/simple/Directory: add method IsReallyAFile()

parent 5dc7cb87
...@@ -111,6 +111,15 @@ public: ...@@ -111,6 +111,15 @@ public:
return new Directory(std::string(), nullptr); 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 { bool IsMount() const noexcept {
return mounted_database != nullptr; return mounted_database != nullptr;
} }
......
...@@ -59,8 +59,7 @@ DirectoryExists(Storage &storage, const Directory &directory) noexcept ...@@ -59,8 +59,7 @@ DirectoryExists(Storage &storage, const Directory &directory) noexcept
return false; return false;
} }
return directory.device == DEVICE_INARCHIVE || return directory.IsReallyAFile()
directory.device == DEVICE_CONTAINER
? info.IsRegular() ? info.IsRegular()
: info.IsDirectory(); : info.IsDirectory();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment