Created
May 28, 2014 01:20
-
-
Save realistschuckle/6f37e6fd0f5c8a740f59 to your computer and use it in GitHub Desktop.
Patch for dylibbundler with a right-trim on it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Dependency.cpp b/src/Dependency.cpp | |
index 82dd3b0..a441474 100644 | |
--- a/src/Dependency.cpp | |
+++ b/src/Dependency.cpp | |
@@ -14,6 +14,10 @@ | |
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
*/ | |
+#include <algorithm> | |
+#include <functional> | |
+#include <cctype> | |
+#include <locale> | |
#include "Dependency.h" | |
#include <iostream> | |
#include <cstdlib> | |
@@ -30,6 +34,11 @@ std::string stripPrefix(std::string in) | |
return in.substr(in.rfind("/")+1); | |
} | |
+static inline std::string& rtrim(std::string &s) { | |
+ s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end()); | |
+ return s; | |
+} | |
+ | |
//the pathes to search for dylibs, store it globally to parse the environment variables only once | |
std::vector<std::string> pathes; | |
@@ -78,7 +87,7 @@ Dependency::Dependency(std::string path) | |
char original_file_buffer[PATH_MAX]; | |
std::string original_file; | |
- if (not realpath(path.c_str(), original_file_buffer)) | |
+ if (not realpath(rtrim(path).c_str(), original_file_buffer)) | |
{ | |
std::cerr << "\n/!\\ WARNING : Cannot resolve symlink '" << path.c_str() << "'" << std::endl; | |
original_file = path; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment