Do not ask for location of missing library if its prefix is supposed to be ignored.

This commit is contained in:
Jose Santiago 2018-02-23 13:17:55 -06:00
parent 84440587e1
commit 11ac86e086
3 changed files with 17 additions and 9 deletions

View File

@ -135,7 +135,8 @@ Dependency::Dependency(std::string path)
}
//If the location is still unknown, ask the user for search path
if( prefix.empty() || !fileExists( prefix+filename ) )
if( !Settings::isPrefixIgnored(prefix)
&& ( prefix.empty() || !fileExists( prefix+filename ) ) )
{
std::cerr << "\n/!\\ WARNING : Library " << filename << " has an incomplete name (location unknown)" << std::endl;
missing_prefixes = true;

View File

@ -76,19 +76,25 @@ void ignore_prefix(std::string prefix)
prefixes_to_ignore.push_back(prefix);
}
bool isPrefixIgnored(std::string prefix)
{
const int prefix_amount = prefixes_to_ignore.size();
for(int n=0; n<prefix_amount; n++)
{
if(prefix.compare(prefixes_to_ignore[n]) == 0) return true;
}
return false;
}
bool isPrefixBundled(std::string prefix)
{
if(prefix.find(".framework") != std::string::npos) return false;
if(prefix.find("@executable_path") != std::string::npos) return false;
if(prefix.compare("/usr/lib/") == 0) return false;
const int prefix_amount = prefixes_to_ignore.size();
for(int n=0; n<prefix_amount; n++)
{
if(prefix.compare(prefixes_to_ignore[n]) == 0) return false;
}
if(isPrefixIgnored(prefix)) return false;
return true;
}
}
}

View File

@ -31,6 +31,7 @@ namespace Settings
{
bool isPrefixBundled(std::string prefix);
bool isPrefixIgnored(std::string prefix);
void ignore_prefix(std::string prefix);
bool canOverwriteFiles();
@ -56,4 +57,4 @@ std::string inside_lib_path();
void inside_lib_path(std::string p);
}
#endif
#endif