diff options
| author | Léo Lam <leolino.lam@gmail.com> | 2017-05-06 18:21:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-06 18:21:07 +0200 |
| commit | c36d24a851ea8dc00c55de081be6f1bfa2f802c0 (patch) | |
| tree | 7c267c89f987593d50941f3e740755622aa0b837 /Source/Core/Common | |
| parent | 2261224980f597135b482c9551622e1d89ecf07e (diff) | |
| parent | 40653a66073a180fc4036aed0721cd3741911cfb (diff) | |
Merge pull request #5382 from JosJuice/title-id-to-path
Don't duplicate code for getting paths based on title IDs
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/NandPaths.cpp | 19 | ||||
| -rw-r--r-- | Source/Core/Common/NandPaths.h | 3 |
2 files changed, 14 insertions, 8 deletions
diff --git a/Source/Core/Common/NandPaths.cpp b/Source/Core/Common/NandPaths.cpp index 5ab7c2afdd..5afa5ef3f1 100644 --- a/Source/Core/Common/NandPaths.cpp +++ b/Source/Core/Common/NandPaths.cpp @@ -36,20 +36,25 @@ std::string GetTicketFileName(u64 _titleID, FromWhichRoot from) (u32)(_titleID >> 32), (u32)_titleID); } -std::string GetTitleDataPath(u64 _titleID, FromWhichRoot from) +std::string GetTitlePath(u64 title_id, FromWhichRoot from) { - return StringFromFormat("%s/title/%08x/%08x/data/", RootUserPath(from).c_str(), - (u32)(_titleID >> 32), (u32)_titleID); + return StringFromFormat("%s/title/%08x/%08x/", RootUserPath(from).c_str(), + static_cast<u32>(title_id >> 32), static_cast<u32>(title_id)); } -std::string GetTMDFileName(u64 _titleID, FromWhichRoot from) +std::string GetTitleDataPath(u64 _titleID, FromWhichRoot from) { - return GetTitleContentPath(_titleID, from) + "title.tmd"; + return GetTitlePath(_titleID, from) + "data/"; } + std::string GetTitleContentPath(u64 _titleID, FromWhichRoot from) { - return StringFromFormat("%s/title/%08x/%08x/content/", RootUserPath(from).c_str(), - (u32)(_titleID >> 32), (u32)_titleID); + return GetTitlePath(_titleID, from) + "content/"; +} + +std::string GetTMDFileName(u64 _titleID, FromWhichRoot from) +{ + return GetTitleContentPath(_titleID, from) + "title.tmd"; } std::string EscapeFileName(const std::string& filename) diff --git a/Source/Core/Common/NandPaths.h b/Source/Core/Common/NandPaths.h index 53b9b1e099..87c7e8b50c 100644 --- a/Source/Core/Common/NandPaths.h +++ b/Source/Core/Common/NandPaths.h @@ -27,9 +27,10 @@ std::string RootUserPath(FromWhichRoot from); std::string GetImportTitlePath(u64 title_id, FromWhichRoot from = FROM_SESSION_ROOT); std::string GetTicketFileName(u64 _titleID, FromWhichRoot from); -std::string GetTMDFileName(u64 _titleID, FromWhichRoot from); +std::string GetTitlePath(u64 title_id, FromWhichRoot from); std::string GetTitleDataPath(u64 _titleID, FromWhichRoot from); std::string GetTitleContentPath(u64 _titleID, FromWhichRoot from); +std::string GetTMDFileName(u64 _titleID, FromWhichRoot from); // Escapes characters that are invalid or have special meanings in the host file system std::string EscapeFileName(const std::string& filename); |
