From ed51f0609773687007b66c08dd0dc598dc3db1c6 Mon Sep 17 00:00:00 2001 From: B3n30 Date: Tue, 17 Mar 2020 13:40:58 +0100 Subject: [PATCH] fix path usage in InstallCia --- src/core/hle/service/am/am.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 44bdfc8a2..31df828e3 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -34,15 +34,6 @@ #include "core/loader/loader.h" #include "core/loader/smdh.h" -namespace { -bool HasSupportedFileExtension(std::string path) { - static const std::array extensions = { - {".3ds", ".3dsx", ".elf", ".axf", ".cci", ".cxi", ".app"}}; - const auto file_ext = FileUtil::GetExtensionFromFilename(path); - return std::find(extensions.begin(), extensions.end(), file_ext) != extensions.end(); -} -} // namespace - namespace Service::AM { constexpr u16 PLATFORM_CTR = 0x0004; @@ -389,7 +380,7 @@ InstallStatus InstallCIA(const std::string& path, const std::string& virtual_name) -> bool { const std::string physical_name = directory + DIR_SEP + virtual_name; const bool is_dir = FileUtil::IsDirectory(physical_name); - if (!is_dir && HasSupportedFileExtension(physical_name)) { + if (!is_dir) { std::unique_ptr loader = Loader::GetLoader(physical_name); if (!loader) { return true; @@ -405,7 +396,12 @@ InstallStatus InstallCIA(const std::string& path, return FileUtil::ForeachDirectoryEntry(nullptr, physical_name, callback); } }; - if (!FileUtil::ForeachDirectoryEntry(nullptr, path, callback)) { + if (!FileUtil::ForeachDirectoryEntry( + nullptr, + GetTitlePath( + Service::AM::GetTitleMediaType(container.GetTitleMetadata().GetTitleID()), + container.GetTitleMetadata().GetTitleID()), + callback)) { LOG_ERROR(Service_AM, "CIA {} contained encrypted files.", path); return InstallStatus::ErrorEncrypted; }