Better handling for excluded paths
This commit is contained in:
parent
a1c30b834c
commit
7ede0feb2c
|
@ -36,7 +36,8 @@ void ImportProject::ignorePaths(const std::vector<std::string> &ipaths)
|
||||||
{
|
{
|
||||||
for (std::list<FileSettings>::iterator it = fileSettings.begin(); it != fileSettings.end();) {
|
for (std::list<FileSettings>::iterator it = fileSettings.begin(); it != fileSettings.end();) {
|
||||||
bool ignore = false;
|
bool ignore = false;
|
||||||
for (const std::string &i : ipaths) {
|
for (std::string i : ipaths) {
|
||||||
|
i = mPath + i;
|
||||||
if (it->filename.size() > i.size() && it->filename.compare(0,i.size(),i)==0) {
|
if (it->filename.size() > i.size() && it->filename.compare(0,i.size(),i)==0) {
|
||||||
ignore = true;
|
ignore = true;
|
||||||
break;
|
break;
|
||||||
|
@ -173,14 +174,16 @@ ImportProject::Type ImportProject::import(const std::string &filename, Settings
|
||||||
std::ifstream fin(filename);
|
std::ifstream fin(filename);
|
||||||
if (!fin.is_open())
|
if (!fin.is_open())
|
||||||
return ImportProject::Type::MISSING;
|
return ImportProject::Type::MISSING;
|
||||||
|
|
||||||
|
mPath = Path::getPathFromFilename(Path::fromNativeSeparators(filename));
|
||||||
|
if (!mPath.empty() && !endsWith(mPath,'/'))
|
||||||
|
mPath += '/';
|
||||||
|
|
||||||
if (endsWith(filename, ".json", 5)) {
|
if (endsWith(filename, ".json", 5)) {
|
||||||
importCompileCommands(fin);
|
importCompileCommands(fin);
|
||||||
return ImportProject::Type::COMPILE_DB;
|
return ImportProject::Type::COMPILE_DB;
|
||||||
} else if (endsWith(filename, ".sln", 4)) {
|
} else if (endsWith(filename, ".sln", 4)) {
|
||||||
std::string path(Path::getPathFromFilename(Path::fromNativeSeparators(filename)));
|
importSln(fin,mPath);
|
||||||
if (!path.empty() && !endsWith(path,'/'))
|
|
||||||
path += '/';
|
|
||||||
importSln(fin,path);
|
|
||||||
return ImportProject::Type::VS_SLN;
|
return ImportProject::Type::VS_SLN;
|
||||||
} else if (endsWith(filename, ".vcxproj", 8)) {
|
} else if (endsWith(filename, ".vcxproj", 8)) {
|
||||||
std::map<std::string, std::string, cppcheck::stricmp> variables;
|
std::map<std::string, std::string, cppcheck::stricmp> variables;
|
||||||
|
|
|
@ -103,6 +103,8 @@ private:
|
||||||
void importSln(std::istream &istr, const std::string &path);
|
void importSln(std::istream &istr, const std::string &path);
|
||||||
void importVcxproj(const std::string &filename, std::map<std::string, std::string, cppcheck::stricmp> &variables, const std::string &additionalIncludeDirectories);
|
void importVcxproj(const std::string &filename, std::map<std::string, std::string, cppcheck::stricmp> &variables, const std::string &additionalIncludeDirectories);
|
||||||
void importBcb6Prj(const std::string &projectFilename);
|
void importBcb6Prj(const std::string &projectFilename);
|
||||||
|
|
||||||
|
std::string mPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
Loading…
Reference in New Issue