mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
NandPaths: Return paths that are relative to Wii NAND
Since all FS access will go through the new FS interface (PR #6421) in order to keep track of metadata properly, there is no need to return absolute paths anymore. In fact, returning host paths is a roadblock to using the FS interface. This starts the migration work by adding a way to get paths that are relative to the Wii NAND instead of always getting absolute paths on the host FS. To prepare for future changes, this commit also makes returned paths canonical by removing the trailing slash when it's unneeded. Eventually, once everything has been migrated to the new interface, we can remove the "from" parameter.
This commit is contained in:
@ -42,7 +42,8 @@ static IOS::ES::TMDReader FindTMD(u64 title_id, const std::string& tmd_path)
|
||||
|
||||
IOS::ES::TMDReader ES::FindImportTMD(u64 title_id) const
|
||||
{
|
||||
return FindTMD(title_id, Common::GetImportTitlePath(title_id) + "/content/title.tmd");
|
||||
return FindTMD(title_id, Common::GetImportTitlePath(title_id, Common::FROM_SESSION_ROOT) +
|
||||
"/content/title.tmd");
|
||||
}
|
||||
|
||||
IOS::ES::TMDReader ES::FindInstalledTMD(u64 title_id) const
|
||||
@ -218,7 +219,8 @@ bool ES::InitImport(u64 title_id)
|
||||
// IOS moves the title content directory to /import if the TMD exists during an import.
|
||||
if (File::Exists(Common::GetTMDFileName(title_id, Common::FROM_SESSION_ROOT)))
|
||||
{
|
||||
const std::string import_content_dir = Common::GetImportTitlePath(title_id) + "/content";
|
||||
const std::string import_content_dir =
|
||||
Common::GetImportTitlePath(title_id, Common::FROM_SESSION_ROOT) + "/content";
|
||||
File::CreateFullPath(import_content_dir);
|
||||
if (!File::Rename(content_dir, import_content_dir))
|
||||
{
|
||||
@ -233,7 +235,8 @@ bool ES::InitImport(u64 title_id)
|
||||
bool ES::FinishImport(const IOS::ES::TMDReader& tmd)
|
||||
{
|
||||
const u64 title_id = tmd.GetTitleId();
|
||||
const std::string import_content_dir = Common::GetImportTitlePath(title_id) + "/content";
|
||||
const std::string import_content_dir =
|
||||
Common::GetImportTitlePath(title_id, Common::FROM_SESSION_ROOT) + "/content";
|
||||
|
||||
// Remove everything not listed in the TMD.
|
||||
std::unordered_set<std::string> expected_entries = {"title.tmd"};
|
||||
@ -274,7 +277,8 @@ bool ES::WriteImportTMD(const IOS::ES::TMDReader& tmd)
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string dest = Common::GetImportTitlePath(tmd.GetTitleId()) + "/content/title.tmd";
|
||||
const std::string dest = Common::GetImportTitlePath(tmd.GetTitleId(), Common::FROM_SESSION_ROOT) +
|
||||
"/content/title.tmd";
|
||||
return File::Rename(tmd_path, dest);
|
||||
}
|
||||
|
||||
@ -282,7 +286,8 @@ void ES::FinishStaleImport(u64 title_id)
|
||||
{
|
||||
const auto import_tmd = FindImportTMD(title_id);
|
||||
if (!import_tmd.IsValid())
|
||||
File::DeleteDirRecursively(Common::GetImportTitlePath(title_id) + "/content");
|
||||
File::DeleteDirRecursively(Common::GetImportTitlePath(title_id, Common::FROM_SESSION_ROOT) +
|
||||
"/content");
|
||||
else
|
||||
FinishImport(import_tmd);
|
||||
}
|
||||
@ -305,7 +310,7 @@ std::string ES::GetContentPath(const u64 title_id, const IOS::ES::Content& conte
|
||||
return content_map.GetFilenameFromSHA1(content.sha1).value_or("");
|
||||
|
||||
return Common::GetTitleContentPath(title_id, Common::FROM_SESSION_ROOT) +
|
||||
StringFromFormat("%08x.app", content.id);
|
||||
StringFromFormat("/%08x.app", content.id);
|
||||
}
|
||||
} // namespace Device
|
||||
} // namespace HLE
|
||||
|
@ -342,7 +342,8 @@ static bool CheckIfContentHashMatches(const std::vector<u8>& content, const IOS:
|
||||
|
||||
static std::string GetImportContentPath(u64 title_id, u32 content_id)
|
||||
{
|
||||
return Common::GetImportTitlePath(title_id) + StringFromFormat("/content/%08x.app", content_id);
|
||||
return Common::GetImportTitlePath(title_id, Common::FROM_SESSION_ROOT) +
|
||||
StringFromFormat("/content/%08x.app", content_id);
|
||||
}
|
||||
|
||||
ReturnCode ES::ImportContentEnd(Context& context, u32 content_fd)
|
||||
@ -604,7 +605,7 @@ ReturnCode ES::DeleteContent(u64 title_id, u32 content_id) const
|
||||
return ES_EINVAL;
|
||||
|
||||
if (!File::Delete(Common::GetTitleContentPath(title_id, Common::FROM_SESSION_ROOT) +
|
||||
StringFromFormat("%08x.app", content_id)))
|
||||
StringFromFormat("/%08x.app", content_id)))
|
||||
{
|
||||
return FS_ENOENT;
|
||||
}
|
||||
|
@ -83,7 +83,8 @@ IPCCommandResult NetKDRequest::IOCtl(const IOCtlRequest& request)
|
||||
if (config.CreationStage() == NWC24::NWC24Config::NWC24_IDCS_INITIAL)
|
||||
{
|
||||
const std::string settings_file_path(
|
||||
Common::GetTitleDataPath(Titles::SYSTEM_MENU, Common::FROM_SESSION_ROOT) + WII_SETTING);
|
||||
Common::GetTitleDataPath(Titles::SYSTEM_MENU, Common::FROM_SESSION_ROOT) +
|
||||
"/" WII_SETTING);
|
||||
SettingsHandler gen;
|
||||
std::string area, model;
|
||||
bool got_settings = false;
|
||||
|
Reference in New Issue
Block a user