mirror of
https://github.com/clangen/musikcube.git
synced 2025-03-29 19:20:28 +00:00
HttpDataStream/LruDiskCache fixes.
This commit is contained in:
parent
1b8cd6bb7f
commit
360d6a22e0
@ -271,9 +271,14 @@ bool HttpDataStream::Open(const char *rawUri, OpenFlags flags) {
|
||||
|
||||
if (diskCache.Cached(id)) {
|
||||
FILE* file = diskCache.Open(id, "rb", this->type, this->length);
|
||||
this->reader.reset(new FileReadStream(file, this->length));
|
||||
this->state = Cached;
|
||||
return true;
|
||||
if (file) {
|
||||
this->reader.reset(new FileReadStream(file, this->length));
|
||||
this->state = Cached;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
diskCache.Delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
this->writeFile = diskCache.Open(id, "wb");
|
||||
|
@ -152,7 +152,7 @@ LruDiskCache::EntryPtr LruDiskCache::Parse(const fs::path& path) {
|
||||
try {
|
||||
auto entry = std::shared_ptr<Entry>(new Entry());
|
||||
entry->id = std::stoull(parts[1].c_str());
|
||||
entry->path = fn;
|
||||
entry->path = path.string();
|
||||
entry->type = parts[2];
|
||||
entry->time = fs::last_write_time(path);
|
||||
al::replace_all(entry->type, "-", "/");
|
||||
|
Loading…
x
Reference in New Issue
Block a user