db/simple/Directory: add LookupResult::uri
This commit is contained in:
parent
6c8eb3c7ed
commit
bcf4645263
@ -133,7 +133,7 @@ Directory::LookupDirectory(const char *_uri) noexcept
|
||||
assert(_uri != nullptr);
|
||||
|
||||
if (isRootDirectory(_uri))
|
||||
return { this, nullptr };
|
||||
return { this, _uri, nullptr };
|
||||
|
||||
StringView uri(_uri);
|
||||
|
||||
@ -156,7 +156,7 @@ Directory::LookupDirectory(const char *_uri) noexcept
|
||||
uri = rest;
|
||||
} while (uri != nullptr);
|
||||
|
||||
return { d, uri.data };
|
||||
return { d, StringView(_uri, uri.data - 1), uri.data };
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -182,6 +182,11 @@ public:
|
||||
*/
|
||||
Directory *directory;
|
||||
|
||||
/**
|
||||
* The URI part which resolved to the #directory.
|
||||
*/
|
||||
std::string_view uri;
|
||||
|
||||
/**
|
||||
* The remaining URI part (without leading slash) or
|
||||
* nullptr if the given URI was consumed completely.
|
||||
|
@ -217,7 +217,7 @@ SimpleDatabase::GetSong(const char *uri) const
|
||||
return nullptr;
|
||||
|
||||
prefixed_light_song =
|
||||
new PrefixedLightSong(*song, r.directory->GetPath());
|
||||
new PrefixedLightSong(*song, r.uri);
|
||||
r.directory->mounted_database->ReturnSong(song);
|
||||
return prefixed_light_song;
|
||||
}
|
||||
@ -289,7 +289,7 @@ SimpleDatabase::Visit(const DatabaseSelection &selection,
|
||||
/* pass the request and the remaining uri to the mounted database */
|
||||
protect.unlock();
|
||||
|
||||
WalkMount(r.directory->GetPath(), *(r.directory->mounted_database),
|
||||
WalkMount(r.uri, *(r.directory->mounted_database),
|
||||
(r.rest == nullptr)?"":r.rest, selection,
|
||||
visit_directory, visit_song, visit_playlist);
|
||||
|
||||
|
@ -196,11 +196,7 @@ UpdateService::Enqueue(const char *path, bool discard)
|
||||
storage2 = storage.GetMount(path);
|
||||
path = "";
|
||||
} else {
|
||||
assert(lr.rest > path);
|
||||
assert(lr.rest < path + strlen(path));
|
||||
assert(lr.rest[-1] == '/');
|
||||
|
||||
const std::string mountpoint(path, lr.rest - 1);
|
||||
const std::string mountpoint(lr.uri);
|
||||
storage2 = storage.GetMount(mountpoint.c_str());
|
||||
path = lr.rest;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user