From 1ba60166f185499f4c2fbdb35e02850dddf37fa0 Mon Sep 17 00:00:00 2001 From: SCG82 Date: Sat, 14 Dec 2019 21:05:55 -0800 Subject: [PATCH] refine logging formatting --- src/Dependency.cpp | 16 ++++++++-------- src/DylibBundler.cpp | 35 +++++++++++++++++------------------ src/Settings.cpp | 2 +- src/Utils.cpp | 8 ++++---- 4 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/Dependency.cpp b/src/Dependency.cpp index 4a9f4ba..b8ac685 100644 --- a/src/Dependency.cpp +++ b/src/Dependency.cpp @@ -84,7 +84,7 @@ Dependency::Dependency(std::string path) original_file = searchFilenameInRpaths(path); } else if (!realpath(rtrim(path).c_str(), original_file_buffer)) { - warning_msg = "\n/!\\ WARNING: Cannot resolve path '" + path + "'.\n"; + warning_msg = "\n/!\\ WARNING: Cannot resolve path '" + path + "'\n"; original_file = path; } else { @@ -113,7 +113,7 @@ Dependency::Dependency(std::string path) // check if file is contained in one of the paths for (size_t i=0; i deps_in_file = deps_per_file[filename]; - // check if this library was already added to |deps_per_file[filename]| to avoid duplicates + std::vector deps_in_file = deps_per_file[filename]; bool in_deps_per_file = false; for (int n=0; n& lines) if (output.find("can't open file") != std::string::npos || output.find("No such file") != std::string::npos || output.size() < 1) { - std::cerr << "\n\n/!\\ ERROR: Cannot find file " << filename << " to read its dependencies.\n"; + std::cerr << "\n\n/!\\ ERROR: Cannot find file " << filename << " to read its dependencies\n"; exit(1); } // split output @@ -272,7 +271,7 @@ void createDestDir() std::cout << "* Erasing old output directory " << dest_folder << "\n"; std::string command = std::string("rm -r ") + dest_folder; if (systemp(command) != 0) { - std::cerr << "\n\n/!\\ ERROR: An error occured while attempting to overwrite dest folder.\n"; + std::cerr << "\n\n/!\\ ERROR: An error occured while attempting to overwrite dest folder\n"; exit(1); } dest_exists = false; @@ -283,12 +282,12 @@ void createDestDir() std::cout << "* Creating output directory " << dest_folder << "\n"; std::string command = std::string("mkdir -p ") + dest_folder; if (systemp(command) != 0) { - std::cerr << "\n\n/!\\ ERROR: An error occured while creating dest folder.\n"; + std::cerr << "\n\n/!\\ ERROR: An error occured while creating dest folder\n"; exit(1); } } else { - std::cerr << "\n\n/!\\ ERROR: Dest folder does not exist. Create it or pass the appropriate flag for automatic dest dir creation.\n"; + std::cerr << "\n\n/!\\ ERROR: Dest folder does not exist. Create it or pass the appropriate flag for automatic dest dir creation\n"; exit(1); } } diff --git a/src/Settings.cpp b/src/Settings.cpp index 4c177f4..b9d82ed 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -72,7 +72,7 @@ bool isPrefixBundled(std::string prefix) return false; if (prefix.compare("/usr/lib/") == 0) return false; - if (prefix.compare("/System/Library/") == 0) + if (prefix.find("/System/Library/") == 0) return false; if (isPrefixIgnored(prefix)) return false; diff --git a/src/Utils.cpp b/src/Utils.cpp index ab51023..338053b 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -51,7 +51,7 @@ void copyFile(std::string from, std::string to) { bool overwrite = Settings::canOverwriteFiles(); if (fileExists(to) && !overwrite) { - std::cerr << "\n\nError: File " << to << " already exists. Remove it or enable overwriting." << "\n"; + std::cerr << "\n\nError: File " << to << " already exists. Remove it or enable overwriting\n"; exit(1); } @@ -128,7 +128,7 @@ std::string getUserInputDirForFile(const std::string& filename) } else { if (Settings::verboseOutput()) { - std::cerr << (searchPath+filename) << " was found.\n" + std::cerr << (searchPath+filename) << " was found\n" << "/!\\ WARNING: dylibbundler MAY NOT CORRECTLY HANDLE THIS DEPENDENCY: Check the executable with 'otool -L'" << "\n"; } return searchPath; @@ -152,11 +152,11 @@ std::string getUserInputDirForFile(const std::string& filename) prefix += "/"; if (!fileExists(prefix+filename)) { - std::cerr << (prefix+filename) << " does not exist. Try again\n"; + std::cerr << (prefix+filename) << " does not exist. Try again...\n"; continue; } else { - std::cerr << (prefix+filename) << " was found.\n" + std::cerr << (prefix+filename) << " was found\n" << "/!\\ WARNINGS: dylibbundler MAY NOT CORRECTLY HANDLE THIS DEPENDENCY: Check the executable with 'otool -L'\n"; return prefix; }