Fixed file not found error

The debug.log would be deleted after launching an example, causing the
example browser to complain that the file cannot be found. In reality,
it should be deleted before launching an example - fixed.
This commit is contained in:
Stefanos A 2013-10-04 10:03:26 +02:00
parent d81bedf5f8
commit 342af2f927

View file

@ -40,23 +40,22 @@ namespace Examples
{
static void LaunchExample(string type)
{
try
{
if (File.Exists("debug.log"))
File.Delete("debug.log");
if (File.Exists("trace.log"))
File.Delete("trace.log");
}
catch (Exception e)
{
Trace.WriteLine(String.Format("Could not access debug.log", e.ToString()));
}
using (TextWriterTraceListener dbg = new TextWriterTraceListener("debug.log"))
using (OpenTK.Toolkit.Init())
{
Trace.Listeners.Add(dbg);
Trace.Listeners.Add(new ConsoleTraceListener());
try
{
if (File.Exists("debug.log"))
File.Delete("debug.log");
if (File.Exists("trace.log"))
File.Delete("trace.log");
}
catch (Exception e)
{
Trace.WriteLine(String.Format("Could not access debug.log", e.ToString()));
}
try
{
@ -75,6 +74,8 @@ namespace Examples
type, e.ToString()));
}
Trace.Listeners.Remove(dbg);
dbg.Flush();
dbg.Close();
}
@ -83,6 +84,8 @@ namespace Examples
[STAThread]
public static void Main(string[] args)
{
Trace.Listeners.Add(new ConsoleTraceListener());
if (args.Length > 0)
{
LaunchExample(args[0]);