mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-07-06 17:42:14 +02:00
lr: Imrpoved path handling and adjust ResolveAddOnContentPath order
This commit is contained in:
parent
75ee69c0b5
commit
d0da24920b
@ -28,12 +28,13 @@ namespace sts::lr {
|
||||
}
|
||||
|
||||
std::shared_ptr<ncm::IContentMetaDatabase> content_meta_database;
|
||||
std::shared_ptr<ncm::IContentStorage> content_storage;
|
||||
R_TRY(ncm::impl::OpenContentMetaDatabase(&content_meta_database, storage_id));
|
||||
R_TRY(ncm::impl::OpenContentStorage(&content_storage, storage_id));
|
||||
|
||||
ncm::ContentId data_content_id;
|
||||
R_TRY(ncm::impl::OpenContentMetaDatabase(&content_meta_database, storage_id));
|
||||
R_TRY(content_meta_database->GetLatestData(&data_content_id, tid));
|
||||
|
||||
std::shared_ptr<ncm::IContentStorage> content_storage;
|
||||
R_TRY(ncm::impl::OpenContentStorage(&content_storage, storage_id));
|
||||
R_ASSERT(content_storage->GetPath(&path, data_content_id));
|
||||
*out.pointer = path;
|
||||
|
||||
|
@ -30,23 +30,20 @@ namespace sts::lr {
|
||||
}
|
||||
|
||||
Path(const char* path) {
|
||||
strlcpy(this->path, path, MaxPathLen);
|
||||
strncpy(this->path, path, MaxPathLen-1);
|
||||
this->EnsureNullTerminated();
|
||||
}
|
||||
|
||||
Path& operator=(const Path& other) {
|
||||
/* N appears to always memcpy paths, so we will too. */
|
||||
memcpy(this->path, other.path, MaxPathLen);
|
||||
std::memcpy(this->path, other.path, MaxPathLen);
|
||||
this->EnsureNullTerminated();
|
||||
return *this;
|
||||
}
|
||||
|
||||
void EnsureNullTerminated() {
|
||||
const size_t len = strnlen(this->path, MaxPathLen);
|
||||
|
||||
if (len == MaxPathLen) {
|
||||
path[MaxPathLen-1] = '\0';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<class Key, class Value, size_t N>
|
||||
|
Loading…
Reference in New Issue
Block a user