logic: vs solution parsing fix

Fixed vs solution parsing to be able to handle some more variations of vs solution layouts...
This commit is contained in:
Manuel Dobusch
2016-02-23 16:49:02 +01:00
parent f0178fb3c6
commit 8a2c4b4e9b
7 changed files with 48 additions and 5 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -56,6 +56,7 @@
</Strings>
</Button>
<!--
<Button guid="guidCoatiPluginCmdSet" id="cmdidCoatiCreateProject" priority="0x0100" type="Button">
<Parent guid="guidCoatiPluginCmdSet" id="MyMenuGroup" />
<Icon guid="icon" id="icon0" />
@@ -63,6 +64,7 @@
<ButtonText>Create Coati Project</ButtonText>
</Strings>
</Button>
-->
<Button guid="guidCoatiPluginCmdSet" id="cmdidCoatiCreateProject" priority="0x0100" type="Button">
<Parent guid="guidCoatiPluginCmdSet" id="SubMenu" />
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="acf15780-03b5-440e-a41e-db79b7043fc2" Version="0.4.1" Language="en-US" Publisher="Coati Software" />
<Identity Id="acf15780-03b5-440e-a41e-db79b7043fc2" Version="0.5.0" Language="en-US" Publisher="Coati Software OG" />
<DisplayName>CoatiPlugin</DisplayName>
<Description xml:space="preserve">This package allows Coati to communicate with Visual Studio and vice versa.</Description>
<Description xml:space="preserve">This package allows Coati to communicate with Visual Studio and vice versa.
More infos at www.coati.io</Description>
<Icon>coati.ico</Icon>
</Metadata>
<Installation InstalledByMsi="false">
@@ -147,6 +147,7 @@ std::vector<std::string> SolutionParserVisualStudio::findProjectItems()
}
TiXmlElement* root = getFirstTagByNameWithAttribute(doc.RootElement(), "ClCompile", "Include");
TiXmlElement* headerRoot = getFirstTagByNameWithAttribute(doc.RootElement(), "ClInclude", "Include");
if (root != NULL)
{
// std::string text(root->GetText());
@@ -157,7 +158,7 @@ std::vector<std::string> SolutionParserVisualStudio::findProjectItems()
text = root->Attribute("Include");
}
if (text.find(".cpp") == std::string::npos)
if (text.find(".cpp") == std::string::npos && text.find(".c") == std::string::npos)
{
root = NULL;
}
@@ -167,7 +168,26 @@ std::vector<std::string> SolutionParserVisualStudio::findProjectItems()
}
}
if (root == NULL)
if (headerRoot != NULL)
{
std::string tag = headerRoot->Value();
std::string text = "";
if (headerRoot->Attribute("Include") != NULL)
{
text = headerRoot->Attribute("Include");
}
if (text.find(".h") == std::string::npos && text.find(".hpp") == std::string::npos)
{
headerRoot = NULL;
}
else
{
headerRoot = headerRoot->Parent()->ToElement();
}
}
/*if (root == NULL)
{
TiXmlElement* root = getFirstTagByNameWithAttribute(doc.RootElement(), "ClInclude", "Include");
if (root != NULL)
@@ -178,7 +198,9 @@ std::vector<std::string> SolutionParserVisualStudio::findProjectItems()
{
root = NULL;
}
}
}*/
if (root != NULL)
{
@@ -197,6 +219,24 @@ std::vector<std::string> SolutionParserVisualStudio::findProjectItems()
}
}
}
if (headerRoot != NULL)
{
for (TiXmlElement* child = headerRoot->FirstChildElement(); child != NULL; child = child->NextSiblingElement())
{
std::string filePath = child->Attribute("Include");
if (relativeProjectPaths[i].size() > 0)
{
filePath = relativeProjectPaths[i] + "/" + filePath;
}
if (checkValidFileExtension(filePath, validFileExtensions))
{
projectItems.push_back(filePath);
}
}
}
}
std::set<std::string> s(projectItems.begin(), projectItems.end());