fix clang-format

This commit is contained in:
B3n30 2020-03-15 18:42:53 +01:00
parent ae4ba287d5
commit 391580c658
2 changed files with 16 additions and 22 deletions

View File

@ -46,15 +46,13 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
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 && HasSupportedFileExtension(physical_name)) {
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;
} }
bool executable = false; bool executable = false;
auto res = loader->IsExecutable(executable); auto res = loader->IsExecutable(executable);
if (!executable && res != Loader::ResultStatus::ErrorEncrypted) if (!executable && res != Loader::ResultStatus::ErrorEncrypted) {
{
return true; return true;
} }

View File

@ -9,9 +9,9 @@
#include <cryptopp/aes.h> #include <cryptopp/aes.h>
#include <cryptopp/modes.h> #include <cryptopp/modes.h>
#include <fmt/format.h> #include <fmt/format.h>
#include "common/common_paths.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/common_paths.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "core/core.h" #include "core/core.h"
#include "core/file_sys/errors.h" #include "core/file_sys/errors.h"
@ -36,13 +36,13 @@
namespace { namespace {
bool HasSupportedFileExtension(std::string path) { bool HasSupportedFileExtension(std::string path) {
static const std::array<std::string, 7> extensions = {{".3ds", ".3dsx", ".elf", ".axf", static const std::array<std::string, 7> extensions = {{".3ds", ".3dsx", ".elf", ".axf", ".cci",
".cci", ".cxi" ".app" ".cxi"
}}; ".app"}};
const auto file_ext = FileUtil::GetExtensionFromFilename(path); const auto file_ext = FileUtil::GetExtensionFromFilename(path);
return std::find(extensions.begin(), extensions.end(), file_ext) != extensions.end(); return std::find(extensions.begin(), extensions.end(), file_ext) != extensions.end();
} }
} } // namespace
namespace Service::AM { namespace Service::AM {
@ -385,32 +385,28 @@ InstallStatus InstallCIA(const std::string& path,
LOG_INFO(Service_AM, "Installed {} successfully.", path); LOG_INFO(Service_AM, "Installed {} successfully.", path);
const FileUtil::DirectoryEntryCallable callback = [&callback](u64* num_entries_out, const FileUtil::DirectoryEntryCallable callback =
const std::string& directory, [&callback](u64* num_entries_out, const std::string& directory,
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 && HasSupportedFileExtension(physical_name)) {
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;
} }
bool executable = false; bool executable = false;
auto res = loader->IsExecutable(executable); auto res = loader->IsExecutable(executable);
if (res == Loader::ResultStatus::ErrorEncrypted) if (res == Loader::ResultStatus::ErrorEncrypted) {
{
return false; return false;
} }
return true; return true;
} else { } else {
return FileUtil::ForeachDirectoryEntry(nullptr, physical_name, callback); return FileUtil::ForeachDirectoryEntry(nullptr, physical_name, callback);
} }
}; };
if (!FileUtil::ForeachDirectoryEntry(nullptr, path, callback)) if (!FileUtil::ForeachDirectoryEntry(nullptr, path, 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;
} }