Skip to content

Commit

Permalink
Fixing uses of options_log_verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
indigodarkwolf committed Jun 2, 2024
1 parent 17318e6 commit b313788
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@

bool files_find(std::filesystem::path &real_path, const std::filesystem::path &search_path)
{
options_log_verbose("Finding file: %s\n", search_path.generic_string().c_str());
options_log_verbose("Finding file: {}\n", search_path.generic_string());

// 1. Local CWD or absolute path
real_path = search_path;
if (std::filesystem::exists(real_path)) {
options_log_verbose("Found file: %s (%s)\n", real_path.generic_string().c_str(), std::filesystem::absolute(real_path).generic_string().c_str());
options_log_verbose("Found file: {} ({})\n", real_path.generic_string(), std::filesystem::absolute(real_path).generic_string());
return true;
}

if (!search_path.is_absolute()) {
// 2. Relative to the location of box16.exe
real_path = options_get_base_path() / search_path;
if (std::filesystem::exists(real_path)) {
options_log_verbose("Found file: %s (%s)\n", real_path.generic_string().c_str(), std::filesystem::absolute(real_path).generic_string().c_str());
options_log_verbose("Found file: {} ({})\n", real_path.generic_string(), std::filesystem::absolute(real_path).generic_string());
return true;
}

// 3. Relative to the prefs directory
real_path = options_get_prefs_path() / search_path;
if (std::filesystem::exists(real_path)) {
options_log_verbose("Found file: %s (%s)\n", real_path.generic_string().c_str(), std::filesystem::absolute(real_path).generic_string().c_str());
options_log_verbose("Found file: {} ({})\n", real_path.generic_string(), std::filesystem::absolute(real_path).generic_string());
return true;
}
}
Expand All @@ -57,7 +57,7 @@ std::tuple<void *, size_t> files_load(const std::filesystem::path &path)
const auto [ops_data, ops_size] = [&]() -> std::tuple<void *, size_t> {
SDL_RWops *ops = SDL_RWFromFile(real_path.generic_string().c_str(), "r+b");
if (ops == nullptr) {
options_log_verbose("Could not open file for read: %s", real_path.generic_string().c_str());
options_log_verbose("Could not open file for read: {}", real_path.generic_string());
return std::make_tuple(nullptr, 0);
}

Expand Down
14 changes: 7 additions & 7 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,7 @@ void load_options()

void save_options(bool all)
{
options_log_verbose("Saving ini to: %s\n", std::filesystem::absolute(Options_ini_path).generic_string().c_str());
options_log_verbose("Saving ini to: {}\n", std::filesystem::absolute(Options_ini_path).generic_string());

mINI::INIFile file(Options_ini_path.generic_string());
mINI::INIStructure ini;
Expand All @@ -1608,7 +1608,7 @@ void save_options(bool all)

void save_options_on_close(bool all)
{
options_log_verbose("Saving ini (on close) to: %s\n", std::filesystem::absolute(Options_ini_path).generic_string().c_str());
options_log_verbose("Saving ini (on close) to: {}\n", std::filesystem::absolute(Options_ini_path).generic_string());

mINI::INIFile file(Options_ini_path.generic_string());

Expand Down Expand Up @@ -1662,32 +1662,32 @@ char const *option_get_source_name(option_source source)

bool options_find_file(std::filesystem::path &real_path, const std::filesystem::path &search_path)
{
options_log_verbose("Finding file: %s\n", search_path.generic_string().c_str());
options_log_verbose("Finding file: {}\n", search_path.generic_string());

// 1. Local CWD or absolute path
real_path = search_path;
if (std::filesystem::exists(real_path)) {
options_log_verbose("Found file: %s (%s)\n", real_path.generic_string().c_str(), std::filesystem::absolute(real_path).generic_string().c_str());
options_log_verbose("Found file: {} ({})\n", real_path.generic_string(), std::filesystem::absolute(real_path).generic_string());
return true;
}

if (!search_path.is_absolute()) {
// 2. Relative to the location of box16.exe
real_path = Options_base_path / search_path;
if (std::filesystem::exists(real_path)) {
options_log_verbose("Found file: %s (%s)\n", real_path.generic_string().c_str(), std::filesystem::absolute(real_path).generic_string().c_str());
options_log_verbose("Found file: {} ({})\n", real_path.generic_string(), std::filesystem::absolute(real_path).generic_string());
return true;
}

// 3. Relative to the prefs directory
real_path = Options_prefs_path / search_path;
if (std::filesystem::exists(real_path)) {
options_log_verbose("Found file: %s (%s)\n", real_path.generic_string().c_str(), std::filesystem::absolute(real_path).generic_string().c_str());
options_log_verbose("Found file: {} ({})\n", real_path.generic_string(), std::filesystem::absolute(real_path).generic_string());
return true;
}
}

fmt::print("Could not find {} in the following locations:\n", search_path.generic_string().c_str());
fmt::print("Could not find {} in the following locations:\n", search_path.generic_string());
fmt::print("\t{}\n", search_path.generic_string());
if (!search_path.is_absolute()) {
fmt::print("\t{}\n", (Options_base_path / search_path).generic_string());
Expand Down

0 comments on commit b313788

Please sign in to comment.