From f6e0a7cf379f0b4eb934c1e09983f1cd213b0e6a Mon Sep 17 00:00:00 2001 From: AdamSimpson Date: Tue, 15 Aug 2017 21:59:59 -0400 Subject: [PATCH] Remove boost filesystem as it's a library and fix bug in logic --- src/dl-intercept.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/dl-intercept.cpp b/src/dl-intercept.cpp index 9452a9a..69288d8 100644 --- a/src/dl-intercept.cpp +++ b/src/dl-intercept.cpp @@ -12,7 +12,6 @@ #include #include #include "boost/algorithm/string.hpp" -#include "boost/filesystem.hpp" static std::unordered_map substitutions; @@ -52,10 +51,15 @@ static void process_environment_variables() { std::vector substitution_pairs; // Extract substitution pairs into vector - if(boost::filesystem::is_regular_file(dl_substitutions)) { + if(dl_substitutions.find(':') == std::string::npos) { // If a filename was provided or malformed pair // Read substitution pairs from file line by line std::ifstream substitutions_file; substitutions_file.open(dl_substitutions, std::ifstream::in); + if(substitutions_file.bad()) { + std::cout<<"ERROR: Failure to open substitutions file " << dl_substitutions << std::endl; + exit(1); + } + std::string line; while(getline(substitutions_file, line)) { @@ -64,7 +68,7 @@ static void process_environment_variables() { // Ignore line starting with '#' to allow comments // And only add strings which contain a ":" - if(line.at(0) == '#' || line.find(':') != std::string::npos) { + if(line.at(0) == '#' || line.find(':') == std::string::npos) { continue; } else {