@@ -1502,19 +1502,26 @@ private async void BuildAndRun(object? sender, Avalonia.Interactivity.RoutedEven
15021502 }
15031503 else if ( emulatorName . ToLower ( ) == "cspect" )
15041504 {
1505- outLog . Writer . WriteLine ( "Launching CSpect..." ) ;
1506- Process process = new Process ( ) ;
1507- process . StartInfo . FileName = emulatorPath ;
1508- process . StartInfo . Arguments = string . Format (
1509- "-zxnext -tv -w3 -brk -r -mmc=\" {0}\" \" {1}\" " ,
1510- nextDrive ,
1511- Path . Combine ( nextDrive , Path . GetFileNameWithoutExtension ( settings . MainFile ) + ".nex" ) ) ;
1512- process . StartInfo . WorkingDirectory = project . ProjectPath ;
1513- process . StartInfo . UseShellExecute = true ;
1514- process . StartInfo . CreateNoWindow = false ;
1515- outLog . Writer . WriteLine ( process . StartInfo . FileName + " " + process . StartInfo . Arguments ) ;
1516- process . Start ( ) ;
1517- process . WaitForExit ( ) ;
1505+ if ( ! File . Exists ( emulatorPath ) )
1506+ {
1507+ errorMsg = "Emulator not found on: " + emulatorPath ;
1508+ }
1509+ else
1510+ {
1511+ outLog . Writer . WriteLine ( "Launching CSpect..." ) ;
1512+ Process process = new Process ( ) ;
1513+ process . StartInfo . FileName = emulatorPath ;
1514+ process . StartInfo . Arguments = string . Format (
1515+ "-zxnext -tv -w3 -brk -r -mmc=\" {0}\" \" {1}\" " ,
1516+ nextDrive ,
1517+ Path . Combine ( nextDrive , Path . GetFileNameWithoutExtension ( settings . MainFile ) + ".nex" ) ) ;
1518+ process . StartInfo . WorkingDirectory = project . ProjectPath ;
1519+ process . StartInfo . UseShellExecute = false ;
1520+ process . StartInfo . CreateNoWindow = false ;
1521+ outLog . Writer . WriteLine ( process . StartInfo . FileName + " " + process . StartInfo . Arguments ) ;
1522+ process . Start ( ) ;
1523+ process . WaitForExit ( ) ;
1524+ }
15181525 }
15191526 else if ( emulatorName . ToLower ( ) == "zesarux" )
15201527 {
@@ -1526,7 +1533,7 @@ private async void BuildAndRun(object? sender, Avalonia.Interactivity.RoutedEven
15261533 nextDrive ,
15271534 Path . Combine ( nextDrive , Path . GetFileNameWithoutExtension ( settings . MainFile ) + ".nex" ) ) ;
15281535 process . StartInfo . WorkingDirectory = Path . GetDirectoryName ( emulatorPath ) ;
1529- process . StartInfo . UseShellExecute = true ;
1536+ process . StartInfo . UseShellExecute = false ;
15301537 process . StartInfo . CreateNoWindow = false ;
15311538 outLog . Writer . WriteLine ( process . StartInfo . FileName + " " + process . StartInfo . Arguments ) ;
15321539 process . Start ( ) ;
@@ -1539,7 +1546,12 @@ private async void BuildAndRun(object? sender, Avalonia.Interactivity.RoutedEven
15391546 }
15401547 catch ( Exception ex )
15411548 {
1542- errorMsg = "Error executing emulator" ;
1549+ errorMsg = "Error executing emulator: " + ex . Message + ex . StackTrace ;
1550+ if ( ex . InnerException != null )
1551+ {
1552+ var ex2 = ex . InnerException ;
1553+ errorMsg += "\r \n Inner Exception: " + ex . Message + ex . StackTrace ;
1554+ }
15431555 }
15441556 }
15451557
@@ -1625,6 +1637,8 @@ private async void BuildAndRun(object? sender, Avalonia.Interactivity.RoutedEven
16251637 }
16261638 } ) ;
16271639 }
1640+
1641+
16281642 private async void BuildAndDebug ( object ? sender , Avalonia . Interactivity . RoutedEventArgs e )
16291643 {
16301644 if ( string . IsNullOrWhiteSpace ( ZXOptions . Current . ZxbcPath ) || string . IsNullOrWhiteSpace ( ZXOptions . Current . ZxbasmPath ) )
0 commit comments