Add search path arg
This commit is contained in:
parent
ce13cb585e
commit
d7c462a813
|
@ -97,4 +97,9 @@ bool isPrefixBundled(std::string prefix)
|
|||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::string> searchPaths;
|
||||
void addSearchPath(std::string path){ searchPaths.push_back(path); }
|
||||
int searchPathAmount(){ return searchPaths.size(); }
|
||||
std::string searchPath(const int n){ return searchPaths[n]; }
|
||||
|
||||
}
|
||||
|
|
|
@ -56,5 +56,9 @@ std::string fileToFix(const int n);
|
|||
std::string inside_lib_path();
|
||||
void inside_lib_path(std::string p);
|
||||
|
||||
void addSearchPath(std::string path);
|
||||
int searchPathAmount();
|
||||
std::string searchPath(const int n);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -169,6 +169,20 @@ int systemp(std::string& cmd)
|
|||
|
||||
std::string getUserInputDirForFile(const std::string& filename)
|
||||
{
|
||||
const int searchPathAmount = Settings::searchPathAmount();
|
||||
for(int n=0; n<searchPathAmount; n++)
|
||||
{
|
||||
auto searchPath = Settings::searchPath(n);
|
||||
if( !searchPath.empty() && searchPath[ searchPath.size()-1 ] != '/' ) searchPath += "/";
|
||||
|
||||
if( !fileExists( searchPath+filename ) ) {
|
||||
continue;
|
||||
} else {
|
||||
std::cerr << (searchPath+filename) << " was found. /!\\MANUALLY CHECK THE EXECUTABLE WITH 'otool -L', DYLIBBUNDLDER MAY NOT HANDLE CORRECTLY THIS UNSTANDARD/ILL-FORMED DEPENDENCY" << std::endl;
|
||||
return searchPath;
|
||||
}
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
std::cout << "Please specify now the directory where this library can be found (or write 'quit' to abort): "; fflush(stdout);
|
||||
|
|
|
@ -121,6 +121,12 @@ int main (int argc, char * const argv[])
|
|||
showHelp();
|
||||
exit(0);
|
||||
}
|
||||
if(strcmp(argv[i],"-s")==0 or strcmp(argv[i],"--search-path")==0)
|
||||
{
|
||||
i++;
|
||||
Settings::addSearchPath(argv[i]);
|
||||
continue;
|
||||
}
|
||||
else if(i>0)
|
||||
{
|
||||
// if we meet an unknown flag, abort
|
||||
|
|
Loading…
Reference in New Issue