storage/Plugin: add "prefixes"
This commit is contained in:
@@ -570,14 +570,15 @@ CurlStorage::OpenDirectory(std::string_view uri_utf8)
|
||||
static std::unique_ptr<Storage>
|
||||
CreateCurlStorageURI(EventLoop &event_loop, const char *uri)
|
||||
{
|
||||
if (!StringStartsWithCaseASCII(uri, "http://") &&
|
||||
!StringStartsWithCaseASCII(uri, "https://"))
|
||||
return nullptr;
|
||||
|
||||
return std::make_unique<CurlStorage>(event_loop, uri);
|
||||
}
|
||||
|
||||
static constexpr const char *curl_prefixes[] = {
|
||||
"http://", "https://", nullptr
|
||||
};
|
||||
|
||||
const StoragePlugin curl_storage_plugin = {
|
||||
"curl",
|
||||
curl_prefixes,
|
||||
CreateCurlStorageURI,
|
||||
};
|
||||
|
@@ -173,4 +173,5 @@ CreateLocalStorage(Path base_fs)
|
||||
constexpr StoragePlugin local_storage_plugin = {
|
||||
"local",
|
||||
nullptr,
|
||||
nullptr,
|
||||
};
|
||||
|
@@ -425,7 +425,10 @@ CreateNfsStorageURI(EventLoop &event_loop, const char *base)
|
||||
server.c_str(), mount);
|
||||
}
|
||||
|
||||
static constexpr const char *nfs_prefixes[] = { "nfs://", nullptr };
|
||||
|
||||
const StoragePlugin nfs_storage_plugin = {
|
||||
"nfs",
|
||||
nfs_prefixes,
|
||||
CreateNfsStorageURI,
|
||||
};
|
||||
|
@@ -377,7 +377,10 @@ CreateUdisksStorageURI(EventLoop &event_loop, const char *base_uri)
|
||||
std::move(inside_path));
|
||||
}
|
||||
|
||||
static constexpr const char *udisks_prefixes[] = { "udisks://", nullptr };
|
||||
|
||||
const StoragePlugin udisks_storage_plugin = {
|
||||
"udisks",
|
||||
udisks_prefixes,
|
||||
CreateUdisksStorageURI,
|
||||
};
|
||||
|
Reference in New Issue
Block a user