Skip to content

Commit

Permalink
Fixes another bug in the IDE with excluding the entire path randomly
Browse files Browse the repository at this point in the history
  • Loading branch information
replaysMike committed Sep 24, 2019
1 parent 0391a29 commit 01c6f5b
Showing 1 changed file with 39 additions and 9 deletions.
48 changes: 39 additions & 9 deletions STM32CubeIDE-TouchGFX-Fix/STM32CubeIDE-TouchGFX-Fix/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,53 @@ private static int RunOptionsAndReturnErrorCode(Options options)
.Descendants("sourceEntries").First();

// add TouchGfx/simulator ignore
var touchGfx = sourceEntries.Descendants("entry").Where(x => x.Attribute("name").Value == "TouchGFX").FirstOrDefault();
if (touchGfx == null)
var touchGfxEntries = sourceEntries.Descendants("entry").Where(x => x.Attribute("name").Value == "TouchGFX");
if (touchGfxEntries.Count() > 1)
{
touchGfx = new XElement("entry", new XAttribute("flags", "VALUE_WORKSPACE_PATH|RESOLVED"), new XAttribute("kind", "sourcePath"), new XAttribute("name", "TouchGFX"));
sourceEntries.Add(touchGfx);
// delete extra entries, the IDE is messed up.
var entriesToRemove = new List<XElement>();
foreach (var entry in touchGfxEntries)
{
if (entry.Attributes("excluding").Any())
entriesToRemove.Add(entry);
}
foreach (var entry in entriesToRemove)
entry.Remove();
hasModifications = true;
}
if (!touchGfx.Attributes("excluding").Any())
if (!touchGfxEntries.Any())
{
touchGfx.Add(new XAttribute("excluding", "simulator"));
sourceEntries.Add(new XElement("entry", new XAttribute("flags", "VALUE_WORKSPACE_PATH|RESOLVED"), new XAttribute("kind", "sourcePath"), new XAttribute("name", "TouchGFX")));
hasModifications = true;
}
if (touchGfxEntries.Any() && !touchGfxEntries.Attributes("excluding").Any())
{
touchGfxEntries.First().Add(new XAttribute("excluding", "simulator"));
hasModifications = true;
}

// add Middlewares ignores
var halSimulator = sourceEntries.Descendants("entry").Where(x => x.Attribute("name").Value == "Middlewares").First();
if (!halSimulator.Attributes("excluding").Any())
var halSimulatorEntries = sourceEntries.Descendants("entry").Where(x => x.Attribute("name").Value == "Middlewares");
if (halSimulatorEntries.Count() > 1)
{
// delete extra entries, the IDE is messed up.
var entriesToRemove = new List<XElement>();
foreach (var entry in halSimulatorEntries)
{
if (entry.Attributes("excluding").Any())
entriesToRemove.Add(entry);
}
foreach (var entry in entriesToRemove)
entry.Remove();
}
if (!halSimulatorEntries.Any())
{
sourceEntries.Add(new XElement("entry", new XAttribute("flags", "VALUE_WORKSPACE_PATH|RESOLVED"), new XAttribute("kind", "sourcePath"), new XAttribute("name", "Middlewares")));
hasModifications = true;
}
if (halSimulatorEntries.Any() && !halSimulatorEntries.Attributes("excluding").Any())
{
halSimulator.Add(new XAttribute("excluding", "ST/TouchGFX/touchgfx/framework/source/platform/driver/touch/SDL2TouchController.cpp|ST/TouchGFX/touchgfx/framework/source/platform/hal/simulator"));
halSimulatorEntries.First().Add(new XAttribute("excluding", "ST/TouchGFX/touchgfx/framework/source/platform/driver/touch/SDL2TouchController.cpp|ST/TouchGFX/touchgfx/framework/source/platform/hal/simulator"));
hasModifications = true;
}

Expand Down

0 comments on commit 01c6f5b

Please sign in to comment.