Skip to content

Commit

Permalink
Fixed some issues relating to pathing.
Browse files Browse the repository at this point in the history
Made output for build more clear.
Build now dumps output in user's "My Documents" folder.
  • Loading branch information
Samson committed Nov 16, 2015
1 parent f08bd82 commit 01c979e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Ev3DL/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ private void btnBrowse_Click(object sender, EventArgs e)
tbFile.Text = openFileDialog1.FileName;
}

private const string includes = "lms2012\\ev3_button.c lms2012\\ev3_command.c lms2012\\ev3_lcd.c lms2012\\ev3_output.c lms2012\\ev3_sound.c lms2012\\ev3_timer.c ";
//TODO: Make this less stupid.
private const string includes = "\"C:\\Program Files (x86)\\Ev3DL\\lmsapi\\ev3_button.c\" \"C:\\Program Files (x86)\\Ev3DL\\lmsapi\\ev3_command.c\" \"C:\\Program Files (x86)\\Ev3DL\\lmsapi\\ev3_lcd.c\" \"C:\\Program Files (x86)\\Ev3DL\\lmsapi\\ev3_output.c\" \"C:\\Program Files (x86)\\Ev3DL\\lmsapi\\ev3_sound.c\" \"C:\\Program Files (x86)\\Ev3DL\\lmsapi\\ev3_timer.c\" ";
private void btnBuild_Click(object sender, EventArgs e)
{
var substrstart= tbFile.Text.LastIndexOf("\\")+1;
var oname = tbFile.Text.Substring(substrstart,tbFile.Text.LastIndexOf(".")-substrstart);
System.Diagnostics.Process BuildProcess = new System.Diagnostics.Process();
BuildProcess.StartInfo.FileName = @"C:\CSLITE\bin\arm-none-linux-gnueabi-g++.exe";
BuildProcess.StartInfo.Arguments = "-static -o "+oname+".out "+ includes + tbFile.Text;
BuildProcess.StartInfo.FileName = @"C:\CSLITE\bin\arm-none-linux-gnueabi-gcc.exe";
string docpath = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +"\\";
BuildProcess.StartInfo.Arguments = "-I \"C:\\Program Files (x86)\\Ev3DL\\lmsapi\" -static -o "+docpath+oname+".out "+ includes + tbFile.Text;
BuildProcess.StartInfo.CreateNoWindow = true;
BuildProcess.StartInfo.UseShellExecute = false;
BuildProcess.StartInfo.RedirectStandardOutput = true;
Expand All @@ -46,10 +48,11 @@ private void btnBuild_Click(object sender, EventArgs e)
BuildProcess.BeginOutputReadLine();
BuildProcess.BeginErrorReadLine();
BuildProcess.WaitForExit();
tbBuildOutput.AppendText("Done Building.\n");
}
void BuildOutputHandler(object sender, System.Diagnostics.DataReceivedEventArgs e)
{
this.BeginInvoke(new MethodInvoker(() => { tbBuildOutput.AppendText(e.Data ?? string.Empty);}));
this.BeginInvoke(new MethodInvoker(() => { tbBuildOutput.AppendText((e.Data!= null) ? e.Data + "\n" : string.Empty);}));
}
}
}

0 comments on commit 01c979e

Please sign in to comment.