refine using clang-tidy suggestions

This commit is contained in:
SCG82 2020-01-06 00:43:42 -08:00
parent e5849e59b9
commit 577c3206d1
9 changed files with 140 additions and 170 deletions

View File

@ -1,27 +1,19 @@
#include "Dependency.h"
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <locale>
#include <sstream>
#include <vector>
// #include <stdlib.h>
#include <sys/param.h>
// #include <sys/stat.h>
#ifndef __clang__
#include <sys/types.h>
#endif
#include <unistd.h>
#include "Settings.h"
#include "Utils.h"
Dependency::Dependency(std::string path, std::string dependent_file) : is_framework(false)
Dependency::Dependency(std::string path, const std::string& dependent_file) : is_framework(false)
{
char original_file_buffer[PATH_MAX];
std::string original_file;
@ -60,8 +52,7 @@ Dependency::Dependency(std::string path, std::string dependent_file) : is_framew
prefix += "/";
// check if this dependency is in /usr/lib, /System/Library, or in ignored list
if (!Settings::isPrefixBundled(prefix))
return;
if (!Settings::isPrefixBundled(prefix)) return;
if (original_file.find(".framework") != std::string::npos) {
is_framework = true;
@ -113,17 +104,25 @@ Dependency::Dependency(std::string path, std::string dependent_file) : is_framew
new_name = filename;
}
std::string Dependency::getInstallPath()
std::string Dependency::getInstallPath() const
{
return Settings::destFolder() + new_name;
}
std::string Dependency::getInnerPath()
std::string Dependency::getInnerPath() const
{
return Settings::insideLibPath() + new_name;
}
void Dependency::addSymlink(std::string s)
void Dependency::print() const
{
std::cout << "\n* " << filename << " from " << prefix << std::endl;
for (const auto& symlink : symlinks) {
std::cout << " symlink --> " << symlink << std::endl;
}
}
void Dependency::addSymlink(const std::string& s)
{
if (std::find(symlinks.begin(), symlinks.end(), s) == symlinks.end())
symlinks.push_back(s);
@ -131,25 +130,16 @@ void Dependency::addSymlink(std::string s)
bool Dependency::mergeIfSameAs(Dependency& dep2)
{
if (dep2.getOriginalFileName().compare(filename) == 0) {
for (size_t n=0; n<symlinks.size(); ++n) {
dep2.addSymlink(symlinks[n]);
if (dep2.getOriginalFileName() == filename) {
for (const auto& symlink : symlinks) {
dep2.addSymlink(symlink);
}
return true;
}
return false;
}
void Dependency::print()
{
std::cout << "\n* " << filename << " from " << prefix << std::endl;
for (size_t n=0; n<symlinks.size(); ++n) {
std::cout << " symlink --> " << symlinks[n] << std::endl;
}
}
void Dependency::copyYourself()
void Dependency::copyToAppBundle() const
{
std::string original_path = getOriginalPath();
std::string dest_path = getInstallPath();
@ -161,10 +151,10 @@ void Dependency::copyYourself()
if (Settings::verboseOutput()) {
std::string inner_path = getInnerPath();
std::cout << "original path: " << original_path << std::endl;
std::cout << "inner path: " << inner_path << std::endl;
std::cout << "dest_path: " << dest_path << std::endl;
std::cout << "install path: " << getInstallPath() << std::endl;
std::cout << " - original path: " << original_path << std::endl;
std::cout << " - inner path: " << inner_path << std::endl;
std::cout << " - dest_path: " << dest_path << std::endl;
std::cout << " - install path: " << getInstallPath() << std::endl;
}
copyFile(original_path, dest_path);
@ -172,13 +162,8 @@ void Dependency::copyYourself()
if (is_framework) {
std::string headers_path = dest_path + std::string("/Headers");
char buffer[PATH_MAX];
if (realpath(rtrim(headers_path).c_str(), buffer))
headers_path = buffer;
if (Settings::verboseOutput())
std::cout << "headers path: " << headers_path << std::endl;
deleteFile(headers_path, true);
deleteFile(dest_path + "/*.prl");
}
@ -186,17 +171,17 @@ void Dependency::copyYourself()
changeId(getInstallPath(), "@rpath/"+new_name);
}
void Dependency::fixFileThatDependsOnMe(std::string file_to_fix)
void Dependency::fixDependentFiles(const std::string& file) const
{
changeInstallName(file_to_fix, getOriginalPath(), getInnerPath());
for (size_t n=0; n<symlinks.size(); ++n) {
changeInstallName(file_to_fix, symlinks[n], getInnerPath());
changeInstallName(file, getOriginalPath(), getInnerPath());
for (const auto& symlink : symlinks) {
changeInstallName(file, symlink, getInnerPath());
}
if (Settings::missingPrefixes()) {
changeInstallName(file_to_fix, filename, getInnerPath());
for (size_t n=0; n<symlinks.size(); ++n) {
changeInstallName(file_to_fix, symlinks[n], getInnerPath());
changeInstallName(file, filename, getInnerPath());
for (const auto& symlink : symlinks) {
changeInstallName(file, symlink, getInnerPath());
}
}
}

View File

@ -8,30 +8,27 @@
class Dependency {
public:
Dependency(std::string path, std::string dependent_file);
Dependency(std::string path, const std::string& dependent_file);
std::string getOriginalFileName() const { return filename; }
std::string getOriginalPath() const { return prefix + filename; }
[[nodiscard]] bool isFramework() const { return is_framework; }
std::string getInstallPath();
std::string getInnerPath();
[[nodiscard]] std::string getPrefix() const { return prefix; }
[[nodiscard]] std::string getOriginalFileName() const { return filename; }
[[nodiscard]] std::string getOriginalPath() const { return prefix + filename; }
bool isFramework() { return is_framework; }
[[nodiscard]] std::string getInstallPath() const;
[[nodiscard]] std::string getInnerPath() const;
void addSymlink(std::string s);
size_t symlinksCount() const { return symlinks.size(); }
void print() const;
std::string getSymlink(int i) const { return symlinks[i]; }
std::string getPrefix() const { return prefix; }
void addSymlink(const std::string& s);
// Compare the given dependency with this one. If both refer to the same file,
// merge both entries into one and return true.
bool mergeIfSameAs(Dependency& dep2);
void print();
void copyYourself();
void fixFileThatDependsOnMe(std::string file);
void copyToAppBundle() const;
void fixDependentFiles(const std::string& file) const;
private:
bool is_framework;
@ -43,6 +40,8 @@ private:
// installation
std::string new_name;
void print();
};
#endif

View File

@ -1,11 +1,11 @@
#include "DylibBundler.h"
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <utility>
#ifdef __linux
#include <linux/limits.h>
@ -25,34 +25,31 @@ std::set<std::string> frameworks;
std::set<std::string> rpaths;
bool qt_plugins_called = false;
void addDependency(std::string path, std::string dependent_file)
void addDependency(std::string path, const std::string& dependent_file)
{
Dependency dep(path, dependent_file);
Dependency dep(std::move(path), dependent_file);
// check if this library was already added to |deps| to avoid duplicates
bool in_deps = false;
for (size_t n=0; n<deps.size(); ++n) {
if (dep.mergeIfSameAs(deps[n]))
for (auto& n : deps) {
if (dep.mergeIfSameAs(n))
in_deps = true;
}
// check if this library was already added to |deps_per_file[dependent_file]| to avoid duplicates
bool in_deps_per_file = false;
for (size_t n=0; n<deps_per_file[dependent_file].size(); ++n) {
if (dep.mergeIfSameAs(deps_per_file[dependent_file][n]))
for (auto& n : deps_per_file[dependent_file]) {
if (dep.mergeIfSameAs(n))
in_deps_per_file = true;
}
// check if this library is in /usr/lib, /System/Library, or in ignored list
if (!Settings::isPrefixBundled(dep.getPrefix()))
return;
if (!Settings::isPrefixBundled(dep.getPrefix())) return;
if (!in_deps && dep.isFramework())
frameworks.insert(dep.getOriginalPath());
if (!in_deps)
deps.push_back(dep);
if (!in_deps_per_file)
deps_per_file[dependent_file].push_back(dep);
}
@ -74,10 +71,9 @@ void collectDependenciesForFile(const std::string& dependent_file)
collectDependenciesForFile(dependent_file, lines);
collectRpathsForFilename(dependent_file);
for (size_t i=0; i<lines.size(); ++i) {
if (!Settings::isPrefixBundled(lines[i]))
continue; // skip system/ignored prefixes
addDependency(lines[i], dependent_file);
for (const auto& line : lines) {
if (!Settings::isPrefixBundled(line)) continue; // skip system/ignored prefixes
addDependency(line, dependent_file);
}
deps_collected[dependent_file] = true;
}
@ -122,16 +118,13 @@ void collectSubDependencies()
collectDependenciesForFile(original_path, lines);
collectRpathsForFilename(original_path);
for (size_t i=0; i<lines.size(); ++i) {
if (!Settings::isPrefixBundled(lines[i]))
continue; // skip system/ignored prefixes
addDependency(lines[i], original_path);
for (const auto& line : lines) {
if (!Settings::isPrefixBundled(line)) continue; // skip system/ignored prefixes
addDependency(line, original_path);
}
}
// if no more dependencies were added on this iteration, stop searching
if (deps.size() == deps_size) {
break;
}
if (deps.size() == deps_size) break;
}
if (Settings::verboseOutput()) {
@ -140,11 +133,11 @@ void collectSubDependencies()
}
if (Settings::bundleLibs() && Settings::bundleFrameworks()) {
if (!qt_plugins_called || (deps.size() != dep_counter))
copyQtPlugins();
bundleQtPlugins();
}
}
void changeLibPathsOnFile(std::string file_to_fix)
void changeLibPathsOnFile(const std::string& file_to_fix)
{
if (deps_collected.find(file_to_fix) == deps_collected.end())
collectDependenciesForFile(file_to_fix);
@ -153,7 +146,7 @@ void changeLibPathsOnFile(std::string file_to_fix)
const size_t dep_amount = deps_per_file[file_to_fix].size();
for (size_t n=0; n<dep_amount; ++n) {
deps_per_file[file_to_fix][n].fixFileThatDependsOnMe(file_to_fix);
deps_per_file[file_to_fix][n].fixDependentFiles(file_to_fix);
}
}
@ -163,12 +156,9 @@ void fixRpathsOnFile(const std::string& original_file, const std::string& file_t
if (Settings::fileHasRpath(original_file))
rpaths_to_fix = Settings::getRpathsForFile(original_file);
for (size_t i=0; i < rpaths_to_fix.size(); ++i) {
std::string command =
std::string("install_name_tool -rpath ")
+ rpaths_to_fix[i] + " "
+ Settings::insideLibPath() + " "
+ file_to_fix;
for (const auto& i : rpaths_to_fix) {
std::string command = std::string("install_name_tool -rpath ");
command += i + " " + Settings::insideLibPath() + " " + file_to_fix;
if (systemp(command) != 0) {
std::cerr << "\n\n/!\\ ERROR: An error occured while trying to fix dependencies of " << file_to_fix << "\n";
exit(1);
@ -176,36 +166,35 @@ void fixRpathsOnFile(const std::string& original_file, const std::string& file_t
}
}
void doneWithDeps_go()
void bundleDependencies()
{
const size_t deps_size = deps.size();
for (size_t n=0; n<deps_size; ++n) {
deps[n].print();
for (const auto& dep : deps) {
dep.print();
}
std::cout << "\n";
if (Settings::verboseOutput()) {
for (std::set<std::string>::iterator it = rpaths.begin(); it != rpaths.end(); ++it) {
std::cout << "rpaths: " << *it << std::endl;
for (const auto& rpath : rpaths) {
std::cout << "rpaths: " << rpath << std::endl;
}
}
// copy & fix up dependencies
if (Settings::bundleLibs()) {
createDestDir();
for (size_t n=0; n<deps_size; ++n) {
deps[n].copyYourself();
changeLibPathsOnFile(deps[n].getInstallPath());
fixRpathsOnFile(deps[n].getOriginalPath(), deps[n].getInstallPath());
for (auto& dep : deps) {
dep.copyToAppBundle();
changeLibPathsOnFile(dep.getInstallPath());
fixRpathsOnFile(dep.getOriginalPath(), dep.getInstallPath());
}
}
// fix up selected files
const size_t filesToFixSize = Settings::filesToFix().size();
for (size_t j=0; j<filesToFixSize; ++j) {
changeLibPathsOnFile(Settings::fileToFix(j));
fixRpathsOnFile(Settings::fileToFix(j), Settings::fileToFix(j));
const auto files_to_fix = Settings::filesToFix();
for (const auto& file_to_fix : files_to_fix) {
changeLibPathsOnFile(file_to_fix);
fixRpathsOnFile(file_to_fix, file_to_fix);
}
}
void copyQtPlugins()
void bundleQtPlugins()
{
bool qtCoreFound = false;
bool qtGuiFound = false;
@ -221,12 +210,13 @@ void copyQtPlugins()
bool qtWebViewFound = false;
std::string original_file;
for (std::set<std::string>::iterator it = frameworks.begin(); it != frameworks.end(); ++it) {
std::string framework = *it;
for (const auto& framework : frameworks) {
if (framework.find("QtCore") != std::string::npos) {
qtCoreFound = true;
original_file = framework;
}
if (framework.find("QtGui") != std::string::npos)
qtGuiFound = true;
if (framework.find("QtNetwork") != std::string::npos)
qtNetworkFound = true;
if (framework.find("QtSql") != std::string::npos)
@ -255,7 +245,7 @@ void copyQtPlugins()
createQtConf(Settings::resourcesFolder());
qt_plugins_called = true;
const auto fixupPlugin = [original_file](std::string plugin) {
const auto fixupPlugin = [original_file](const std::string& plugin) {
std::string dest = Settings::pluginsFolder();
std::string framework_root = getFrameworkRoot(original_file);
std::string prefix = filePrefix(framework_root);
@ -316,5 +306,6 @@ void copyQtPlugins()
fixupPlugin("texttospeech");
if (qtWebViewFound)
fixupPlugin("webview");
collectSubDependencies();
}

View File

@ -6,7 +6,7 @@
#include <string>
#include <vector>
void addDependency(std::string path, std::string dependent_file);
void addDependency(std::string path, const std::string& dependent_file);
// std::string searchFilenameInRpaths(const std::string& rpath_file, const std::string& dependent_file);
// std::string searchFilenameInRpaths(const std::string& rpath_file);
@ -22,11 +22,11 @@ void collectRpathsForFilename(const std::string& filename);
// recursively collect each dependency's dependencies
void collectSubDependencies();
void changeLibPathsOnFile(std::string file_to_fix);
void changeLibPathsOnFile(const std::string& file_to_fix);
void fixRpathsOnFile(const std::string& original_file, const std::string& file_to_fix);
void doneWithDeps_go();
void bundleDependencies();
void copyQtPlugins();
void bundleQtPlugins();
#endif

View File

@ -2,6 +2,7 @@
#include <cstdlib>
#include <map>
#include <utility>
#include <sys/param.h>
@ -31,7 +32,7 @@ bool appBundleProvided() { return !app_bundle.empty(); }
std::string appBundle() { return app_bundle; }
void appBundle(std::string path)
{
app_bundle = path;
app_bundle = std::move(path);
char buffer[PATH_MAX];
if (realpath(app_bundle.c_str(), buffer))
app_bundle = buffer;
@ -59,7 +60,7 @@ void appBundle(std::string path)
std::string destFolder() { return dest_path; }
void destFolder(std::string path)
{
dest_path = path;
dest_path = std::move(path);
if (appBundleProvided())
dest_path = app_bundle + "Contents/" + stripLSlash(dest_folder);
char buffer[PATH_MAX];
@ -89,7 +90,7 @@ size_t filesToFixCount() { return files.size(); }
std::string insideLibPath() { return inside_path; }
void insideLibPath(std::string p)
{
inside_path = p;
inside_path = std::move(p);
if (inside_path[inside_path.size()-1] != '/')
inside_path += "/";
}
@ -101,16 +102,16 @@ void ignorePrefix(std::string prefix)
prefix += "/";
prefixes_to_ignore.push_back(prefix);
}
bool isPrefixIgnored(std::string prefix)
bool isPrefixIgnored(const std::string& prefix)
{
for (size_t n=0; n<prefixes_to_ignore.size(); n++) {
if (prefix.compare(prefixes_to_ignore[n]) == 0)
if (prefix == prefixes_to_ignore[n])
return true;
}
return false;
}
bool isPrefixBundled(std::string prefix)
bool isPrefixBundled(const std::string& prefix)
{
if (!bundle_frameworks && prefix.find(".framework") != std::string::npos)
return false;
@ -125,15 +126,17 @@ bool isPrefixBundled(std::string prefix)
return true;
}
std::vector<std::string> searchPaths;
void addSearchPath(std::string path) { searchPaths.push_back(path); }
std::string searchPath(const int n) { return searchPaths[n]; }
size_t searchPathCount() { return searchPaths.size(); }
std::vector<std::string> search_paths;
void addSearchPath(const std::string& path) { search_paths.push_back(path); }
std::vector<std::string> searchPaths() { return search_paths; }
std::string searchPath(const int n) { return search_paths[n]; }
size_t searchPathCount() { return search_paths.size(); }
std::vector<std::string> userSearchPaths;
void addUserSearchPath(std::string path) { userSearchPaths.push_back(path); }
std::string userSearchPath(const int n) { return userSearchPaths[n]; }
size_t userSearchPathCount() { return userSearchPaths.size(); }
std::vector<std::string> user_search_paths;
void addUserSearchPath(const std::string& path) { user_search_paths.push_back(path); }
std::vector<std::string> userSearchPaths() { return user_search_paths; }
std::string userSearchPath(const int n) { return user_search_paths[n]; }
size_t userSearchPathCount() { return user_search_paths.size(); }
bool canCreateDir() { return create_dir; }
void canCreateDir(bool permission) { create_dir = permission; }

View File

@ -12,8 +12,8 @@
namespace Settings {
bool isPrefixBundled(std::string prefix);
bool isPrefixIgnored(std::string prefix);
bool isPrefixBundled(const std::string& prefix);
bool isPrefixIgnored(const std::string& prefix);
void ignorePrefix(std::string prefix);
bool appBundleProvided();
@ -36,11 +36,13 @@ size_t filesToFixCount();
std::string insideLibPath();
void insideLibPath(std::string p);
void addSearchPath(std::string path);
void addSearchPath(const std::string& path);
std::vector<std::string> searchPaths();
std::string searchPath(int n);
size_t searchPathCount();
void addUserSearchPath(std::string path);
void addUserSearchPath(const std::string& path);
std::vector<std::string> userSearchPaths();
std::string userSearchPath(int n);
size_t userSearchPathCount();
@ -79,5 +81,3 @@ bool fileHasRpath(const std::string& file);
} // namespace Settings
#endif
std::string stripLSlash(const std::string& in);

View File

@ -19,12 +19,12 @@
std::string filePrefix(const std::string& in)
{
return in.substr(0, in.rfind("/")+1);
return in.substr(0, in.rfind('/')+1);
}
std::string stripPrefix(const std::string& in)
{
return in.substr(in.rfind("/")+1);
return in.substr(in.rfind('/')+1);
}
std::string getFrameworkRoot(const std::string& in)
@ -59,15 +59,14 @@ std::string rtrim(std::string s)
std::string systemOutput(const std::string& cmd)
{
FILE* command_output;
FILE *command_output = nullptr;
char output[128];
int amount_read = 1;
std::string full_output;
try {
command_output = popen(cmd.c_str(), "r");
if (command_output == NULL)
throw;
if (command_output == nullptr) throw;
while (amount_read > 0) {
amount_read = fread(output, 1, 127, command_output);
@ -87,17 +86,15 @@ std::string systemOutput(const std::string& cmd)
}
int return_value = pclose(command_output);
if (return_value != 0)
return "";
if (return_value != 0) return "";
return full_output;
}
int systemp(const std::string& cmd)
{
if (!Settings::quietOutput()) {
if (!Settings::quietOutput())
std::cout << " " << cmd << "\n";
}
return system(cmd.c_str());
}
@ -106,17 +103,17 @@ void tokenize(const std::string& str, const char* delim, std::vector<std::string
std::vector<std::string>& tokens = *vectorarg;
std::string delimiters(delim);
// skip delimiters at beginning.
// skip delimiters at beginning
std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
// find first "non-delimiter".
// find first non-delimiter
std::string::size_type pos = str.find_first_of(delimiters, lastPos);
while (pos != std::string::npos || lastPos != std::string::npos) {
// found a token, add it to the vector.
// found a token, add it to the vector
tokens.push_back(str.substr(lastPos, pos - lastPos));
// skip delimiters. Note the "not_of"
// skip delimiters
lastPos = str.find_first_not_of(delimiters, pos);
// find next "non-delimiter"
// find next non-delimiter
pos = str.find_first_of(delimiters, lastPos);
}
}
@ -132,9 +129,8 @@ std::vector<std::string> lsDir(const std::string& path)
bool fileExists(const std::string& filename)
{
if (access(filename.c_str(), F_OK) != -1) {
if (access(filename.c_str(), F_OK) != -1)
return true;
}
std::string delims = " \f\n\r\t\v";
std::string rtrimmed = filename.substr(0, filename.find_last_not_of(delims)+1);
std::string ftrimmed = rtrimmed.substr(rtrimmed.find_first_not_of(delims));
@ -145,7 +141,7 @@ bool fileExists(const std::string& filename)
bool isRpath(const std::string& path)
{
return path.find("@rpath") == 0 || path.find("@loader_path") == 0;
return path.find("@rpath") != std::string::npos || path.find("@loader_path") != std::string::npos;
}
std::string bundleExecutableName(const std::string& app_bundle_path)
@ -283,7 +279,7 @@ std::string getUserInputDirForFile(const std::string& filename)
std::cin >> prefix;
std::cout << std::endl;
if (prefix.compare("quit") == 0 || prefix.compare("exit") == 0 || prefix.compare("abort") == 0)
if (prefix == "quit" || prefix == "exit" || prefix == "abort")
exit(1);
if (!prefix.empty() && prefix[prefix.size()-1] != '/')
@ -310,7 +306,7 @@ void parseLoadCommands(const std::string& file, const std::string& cmd, const st
if (output.find("can't open file") != std::string::npos
|| output.find("No such file") != std::string::npos
|| output.find("at least one file must be specified") != std::string::npos
|| output.size() < 1) {
|| output.empty()) {
std::cerr << "\n\n/!\\ ERROR: Cannot find file " << file << " to read its load commands\n";
exit(1);
}
@ -356,7 +352,7 @@ std::string searchFilenameInRpaths(const std::string& rpath_file, const std::str
}
std::string fullpath;
std::string suffix = rpath_file.substr(rpath_file.rfind("/")+1);
std::string suffix = rpath_file.substr(rpath_file.rfind('/')+1);
char fullpath_buffer[PATH_MAX];
const auto check_path = [&](std::string path) {
@ -410,8 +406,7 @@ std::string searchFilenameInRpaths(const std::string& rpath_file, const std::str
}
else if (!check_path(rpath_file)) {
auto rpaths_for_file = Settings::getRpathsForFile(dependent_file);
for (auto it = rpaths_for_file.begin(); it != rpaths_for_file.end(); ++it) {
std::string rpath = *it;
for (auto rpath : rpaths_for_file) {
if (rpath[rpath.size()-1] != '/')
rpath += "/";
std::string path = rpath + suffix;
@ -423,9 +418,8 @@ std::string searchFilenameInRpaths(const std::string& rpath_file, const std::str
}
if (fullpath.empty()) {
size_t search_path_count = Settings::searchPathCount();
for (size_t i=0; i<search_path_count; ++i) {
std::string search_path = Settings::searchPath(i);
std::vector<std::string> search_paths = Settings::searchPaths();
for (const auto& search_path : search_paths) {
if (fileExists(search_path+suffix)) {
if (Settings::verboseOutput())
std::cout << "FOUND " << suffix << " in " << search_path << std::endl;
@ -464,16 +458,16 @@ void initSearchPaths()
{
std::string searchPaths;
char *dyldLibPath = std::getenv("DYLD_LIBRARY_PATH");
if (dyldLibPath != 0)
if (dyldLibPath != nullptr)
searchPaths = dyldLibPath;
dyldLibPath = std::getenv("DYLD_FALLBACK_FRAMEWORK_PATH");
if (dyldLibPath != 0) {
if (dyldLibPath != nullptr) {
if (!searchPaths.empty() && searchPaths[searchPaths.size()-1] != ':')
searchPaths += ":";
searchPaths += dyldLibPath;
}
dyldLibPath = std::getenv("DYLD_FALLBACK_LIBRARY_PATH");
if (dyldLibPath != 0) {
if (dyldLibPath != nullptr) {
if (!searchPaths.empty() && searchPaths[searchPaths.size()-1] != ':')
searchPaths += ":";
searchPaths += dyldLibPath;

View File

@ -19,9 +19,9 @@ void rtrim_in_place(std::string& s);
// trim from end (copying)
std::string rtrim(std::string s);
// executes a command in the native shell and returns output in string
// execute a command in the native shell and return output in string
std::string systemOutput(const std::string& cmd);
// like 'system', runs a command on the system shell, but also prints the command to stdout.
// run a command in the system shell (like 'system') but also print the command to stdout
int systemp(const std::string& cmd);
void tokenize(const std::string& str, const char* delimiters, std::vector<std::string>*);

View File

@ -4,7 +4,6 @@
#include <iostream>
#include <vector>
#include <string.h>
#ifndef __clang__
#include <sys/types.h>
#endif
@ -125,13 +124,12 @@ int main(int argc, const char* argv[])
std::cout << "Collecting dependencies...\n";
const size_t files_count = Settings::filesToFixCount();
for (size_t j=0; j<files_count; ++j)
collectDependenciesForFile(Settings::fileToFix(j));
const std::vector<std::string> files_to_fix = Settings::filesToFix();
for (const auto& file_to_fix : files_to_fix) {
collectDependenciesForFile(file_to_fix);
}
collectSubDependencies();
doneWithDeps_go();
bundleDependencies();
return 0;
}