From 86ed064edb3626eaebdf953b45215f24f9be8ca8 Mon Sep 17 00:00:00 2001 From: scawful Date: Tue, 28 May 2024 19:40:00 -0400 Subject: [PATCH] update linux home path and remove print debugging statements --- src/app/rom.cc | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/app/rom.cc b/src/app/rom.cc index ff5e2598..71d25f95 100644 --- a/src/app/rom.cc +++ b/src/app/rom.cc @@ -127,19 +127,19 @@ absl::Status Rom::LoadAllGraphicsData() { } absl::Status Rom::LoadFromFile(const std::string& filename, bool z3_load) { - std::cout << "Loading ROM: " << filename << std::endl; + std::string full_filename = filename; #ifdef __linux__ std::string const HOME = std::getenv("HOME") ? std::getenv("HOME") : "."; std::cout << "Home directory: " << HOME << std::endl; - filename = absl::StrCat(HOME, "/", filename); - std::cout << "Full path: " << filename << std::endl; + full_filename = absl::StrCat(HOME, "/", filename); + std::cout << "Full path: " << full_path << std::endl; #endif - if (filename.empty()) { + if (full_filename.empty()) { return absl::InvalidArgumentError( "Could not load ROM: parameter `filename` is empty."); } // Set filename - filename_ = filename; + filename_ = full_filename; // Open file std::ifstream file(filename_, std::ios::binary); @@ -149,14 +149,12 @@ absl::Status Rom::LoadFromFile(const std::string& filename, bool z3_load) { } // Get file size and resize rom_data_ - std::cout << "Getting file size" << std::endl; try { size_ = std::filesystem::file_size(filename_); } catch (const std::filesystem::filesystem_error& e) { return absl::InternalError( absl::StrCat("Could not get file size: ", filename, " - ", e.what())); } - std::cout << "Size of file: " << size_ << std::endl; rom_data_.resize(size_); // Read file into rom_data_ @@ -183,7 +181,6 @@ absl::Status Rom::LoadFromFile(const std::string& filename, bool z3_load) { // Load Zelda 3 specific data if requested if (z3_load) { - std::cout << "Loading Zelda 3 specific data" << std::endl; // Copy ROM title constexpr uint32_t kTitleStringOffset = 0x7FC0; constexpr uint32_t kTitleStringLength = 20; @@ -201,9 +198,6 @@ absl::Status Rom::LoadFromFile(const std::string& filename, bool z3_load) { rom_data_.resize(baseROMSize * 2); size_ = baseROMSize * 2; - std::cout - << "ROM loaded successfully, attempting to create resource label file." - << std::endl; // Set up the resource labels std::string resource_label_filename = absl::StrFormat("%s.labels", filename); resource_label_manager_.LoadLabels(resource_label_filename);