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);
if (!is_dir && HasSupportedFileExtension(physical_name)) {
std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name);
if (!loader)
{
if (!loader) {
return true;
}
bool executable = false;
auto res = loader->IsExecutable(executable);
if (!executable && res != Loader::ResultStatus::ErrorEncrypted)
{
auto res = loader->IsExecutable(executable);
if (!executable && res != Loader::ResultStatus::ErrorEncrypted) {
return true;
}

View file

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