Skip to content

Commit

Permalink
proper source path patching
Browse files Browse the repository at this point in the history
  • Loading branch information
makc committed May 10, 2013
1 parent 4ac98d2 commit 3ef1ac3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions ColtPlugin/PluginMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,37 @@ private void OnTimerElapsed(object sender, EventArgs e)

String message = File.ReadAllText(pathToLog);

// hack: COLT copies sources to "incremental" folder, so let's try to guess-patch correct path
String sourcePath = PluginBase.CurrentProject.SourcePaths[0];
// COLT copies sources to "incremental" folder, so let's try to find correct path and patch the output
String incremental = "colt\\incremental";
String[] sources = PluginBase.CurrentProject.SourcePaths;

// [09.05.2013 17:26:54] Philippe Elsass: make sure you send the log line by line to the Output
String[] messageLines = message.Split(new Char[] {'\r', '\n'});
foreach (String line in messageLines) if (line.Length > 0)
{
// [08.05.2013 18:04:15] Philippe Elsass: you can also specify '-3' as 2nd parameter to the traces (error level)
// [08.05.2013 18:05:02] Philippe Elsass: so it will appear in red in the output and have an error icon in the results panel
TraceManager.AddAsync(line.Replace("colt\\incremental", sourcePath), -3);
if (line.Contains(incremental))
{
// carefully take the file name out
String file = line.Substring(0, line.IndexOf("): col"));
file = file.Substring(0, file.LastIndexOf("("));
file = file.Substring(file.IndexOf(incremental) + incremental.Length + 1);

// look for it in all source folders
for (int i = 0; i < sources.Length; i++)
{
if (File.Exists(PluginBase.CurrentProject.GetAbsolutePath(Path.Combine(sources[i], file))))
{
TraceManager.AddAsync(line.Replace(incremental, sources[i]), -3); break;
}
}
}
else
{
// send as is
TraceManager.AddAsync(line, -3);
}
}
}

Expand Down
Binary file modified ColtPlugin/obj/Debug/ColtPlugin.dll
Binary file not shown.

0 comments on commit 3ef1ac3

Please # to comment.