storage/Composite: eliminate the second FindStorage() overload
It was used in a wrong way, which did not deal with errors consistently. And if that's wrong, there is no need for FindStorage() at all - let's remove it and the confusion around it.
This commit is contained in:
parent
e1a8dcfcc8
commit
f9a64d24bf
@ -265,22 +265,13 @@ CompositeStorage::FindStorage(const char *uri) const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompositeStorage::FindResult
|
|
||||||
CompositeStorage::FindStorage(const char *uri, Error &error) const
|
|
||||||
{
|
|
||||||
auto result = FindStorage(uri);
|
|
||||||
if (result.directory == nullptr)
|
|
||||||
error.Set(composite_domain, "No such directory");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CompositeStorage::GetInfo(const char *uri, bool follow, FileInfo &info,
|
CompositeStorage::GetInfo(const char *uri, bool follow, FileInfo &info,
|
||||||
Error &error)
|
Error &error)
|
||||||
{
|
{
|
||||||
const ScopeLock protect(mutex);
|
const ScopeLock protect(mutex);
|
||||||
|
|
||||||
auto f = FindStorage(uri, error);
|
auto f = FindStorage(uri);
|
||||||
if (f.directory->storage != nullptr &&
|
if (f.directory->storage != nullptr &&
|
||||||
f.directory->storage->GetInfo(f.uri, follow, info, error))
|
f.directory->storage->GetInfo(f.uri, follow, info, error))
|
||||||
return true;
|
return true;
|
||||||
@ -295,6 +286,7 @@ CompositeStorage::GetInfo(const char *uri, bool follow, FileInfo &info,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error.Set(composite_domain, "No such directory");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,13 +296,15 @@ CompositeStorage::OpenDirectory(const char *uri,
|
|||||||
{
|
{
|
||||||
const ScopeLock protect(mutex);
|
const ScopeLock protect(mutex);
|
||||||
|
|
||||||
auto f = FindStorage(uri, error);
|
auto f = FindStorage(uri);
|
||||||
const Directory *directory = f.directory->Find(f.uri);
|
const Directory *directory = f.directory->Find(f.uri);
|
||||||
if (directory == nullptr || directory->children.empty()) {
|
if (directory == nullptr || directory->children.empty()) {
|
||||||
/* no virtual directories here */
|
/* no virtual directories here */
|
||||||
|
|
||||||
if (f.directory->storage == nullptr)
|
if (f.directory->storage == nullptr) {
|
||||||
|
error.Set(composite_domain, "No such directory");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return f.directory->storage->OpenDirectory(f.uri, error);
|
return f.directory->storage->OpenDirectory(f.uri, error);
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,6 @@ private:
|
|||||||
*/
|
*/
|
||||||
gcc_pure
|
gcc_pure
|
||||||
FindResult FindStorage(const char *uri) const;
|
FindResult FindStorage(const char *uri) const;
|
||||||
FindResult FindStorage(const char *uri, Error &error) const;
|
|
||||||
|
|
||||||
const char *MapToRelativeUTF8(const Directory &directory,
|
const char *MapToRelativeUTF8(const Directory &directory,
|
||||||
const char *uri) const;
|
const char *uri) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user