mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-12-28 22:26:55 +00:00
fix path usage in InstallCia
This commit is contained in:
parent
a4457d871c
commit
ed51f06097
|
@ -34,15 +34,6 @@
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
#include "core/loader/smdh.h"
|
#include "core/loader/smdh.h"
|
||||||
|
|
||||||
namespace {
|
|
||||||
bool HasSupportedFileExtension(std::string path) {
|
|
||||||
static const std::array<std::string, 7> 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 {
|
namespace Service::AM {
|
||||||
|
|
||||||
constexpr u16 PLATFORM_CTR = 0x0004;
|
constexpr u16 PLATFORM_CTR = 0x0004;
|
||||||
|
@ -389,7 +380,7 @@ InstallStatus InstallCIA(const std::string& path,
|
||||||
const std::string& virtual_name) -> bool {
|
const std::string& virtual_name) -> bool {
|
||||||
const std::string physical_name = directory + DIR_SEP + virtual_name;
|
const std::string physical_name = directory + DIR_SEP + virtual_name;
|
||||||
const bool is_dir = FileUtil::IsDirectory(physical_name);
|
const bool is_dir = FileUtil::IsDirectory(physical_name);
|
||||||
if (!is_dir && HasSupportedFileExtension(physical_name)) {
|
if (!is_dir) {
|
||||||
std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name);
|
std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name);
|
||||||
if (!loader) {
|
if (!loader) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -405,7 +396,12 @@ InstallStatus InstallCIA(const std::string& path,
|
||||||
return FileUtil::ForeachDirectoryEntry(nullptr, physical_name, callback);
|
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);
|
LOG_ERROR(Service_AM, "CIA {} contained encrypted files.", path);
|
||||||
return InstallStatus::ErrorEncrypted;
|
return InstallStatus::ErrorEncrypted;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue