@@ -250,50 +250,68 @@ private static bool BuildNexFile(byte[] binary, ZXBuildSettings settings, ZXProj
250250 File . Delete ( nexDataFile ) ;
251251 }
252252
253- outputLogWritter . WriteLine ( "Building .nex file..." ) ;
254- Process process = new Process ( ) ;
255- if ( Environment . OSVersion . Platform == PlatformID . Win32NT )
253+ // Build .nex file
256254 {
257- CheckNextCreator ( ) ;
258- process . StartInfo . FileName = Path . Combine ( Path . GetDirectoryName ( ZXOptions . Current . ZxbcPath ) , "python" , "python.exe" ) ;
259- process . StartInfo . Arguments = string . Format ( "{0} nex.cfg {1}" ,
260- Path . Combine ( Path . GetDirectoryName ( ZXOptions . Current . ZxbcPath ) , "tools" , "nextcreator.py" ) ,
261- Path . GetFileNameWithoutExtension ( settings . MainFile ) + ".nex" ) ;
262- process . StartInfo . WorkingDirectory = project . ProjectPath ;
263- process . StartInfo . UseShellExecute = false ;
264- process . StartInfo . CreateNoWindow = true ;
265- process . StartInfo . RedirectStandardOutput = true ;
266- }
267- else
268- {
269- process . StartInfo . FileName = Path . Combine ( Path . GetDirectoryName ( ZXOptions . Current . ZxbcPath ) , "tools" , "nextcreator.py" ) ;
270- process . StartInfo . Arguments = "nex.cfg " + Path . GetFileNameWithoutExtension ( settings . MainFile ) + ".nex" ;
255+ outputLogWritter . WriteLine ( "Building .nex file..." ) ;
256+
257+ var nextCreatorPath = Path . Combine ( Path . GetDirectoryName ( ZXOptions . Current . ZxbcPath ) , "tools" , "nextcreator" ) ;
258+ bool usePython = false ;
259+ if ( File . Exists ( nextCreatorPath + ".exe" ) )
260+ {
261+ nextCreatorPath += ".exe" ;
262+ }
263+ else if ( File . Exists ( nextCreatorPath ) )
264+ {
265+ // Linux
266+ }
267+ else
268+ {
269+ nextCreatorPath += ".py" ;
270+ usePython = true ;
271+ }
272+
273+ //CheckNextCreator();
274+ Process process = new Process ( ) ;
275+ if ( usePython )
276+ {
277+ process . StartInfo . FileName = Path . Combine ( Path . GetDirectoryName ( ZXOptions . Current . ZxbcPath ) , "python" , "python.exe" ) ;
278+ process . StartInfo . Arguments = string . Format ( "{0} nex.cfg {1}" ,
279+ nextCreatorPath ,
280+ Path . GetFileNameWithoutExtension ( settings . MainFile ) + ".nex" ) ;
281+ }
282+ else
283+ {
284+ process . StartInfo . FileName = nextCreatorPath ;
285+ process . StartInfo . Arguments = string . Format ( "nex.cfg {0}" ,
286+ Path . GetFileNameWithoutExtension ( settings . MainFile ) + ".nex" ) ;
287+ }
271288 process . StartInfo . WorkingDirectory = project . ProjectPath ;
272289 process . StartInfo . UseShellExecute = false ;
273290 process . StartInfo . CreateNoWindow = true ;
274291 process . StartInfo . RedirectStandardOutput = true ;
275- }
276- outputLogWritter . WriteLine ( string . Format ( "{0} {1}" ,
277- process . StartInfo . FileName ,
278- process . StartInfo . Arguments ) ) ;
279- process . Start ( ) ;
280- process . WaitForExit ( ) ;
281292
282- if ( ! File . Exists ( nexFile ) )
283- {
284- outputLogWritter . WriteLine ( "Error building .nex file" ) ;
285- outputLogWritter . WriteLine ( process . StartInfo . WorkingDirectory ) ;
293+ outputLogWritter . WriteLine ( string . Format ( "{0} {1}" ,
294+ process . StartInfo . FileName ,
295+ process . StartInfo . Arguments ) ) ;
296+ process . Start ( ) ;
297+ process . WaitForExit ( ) ;
286298
287- using ( StreamReader reader = process . StandardOutput )
299+ if ( ! File . Exists ( nexFile ) )
288300 {
289- string output = reader . ReadToEnd ( ) ;
290- outputLogWritter . WriteLine ( output ) ;
301+ outputLogWritter . WriteLine ( "Error building .nex file" ) ;
302+ outputLogWritter . WriteLine ( process . StartInfo . WorkingDirectory ) ;
303+
304+ using ( StreamReader reader = process . StandardOutput )
305+ {
306+ string output = reader . ReadToEnd ( ) ;
307+ outputLogWritter . WriteLine ( output ) ;
308+ }
309+ return false ;
291310 }
292- return false ;
293- }
294311
295- // Copy .nex file to data folder
296- File . Copy ( nexFile , nexDataFile ) ;
312+ // Copy .nex file to data folder
313+ File . Copy ( nexFile , nexDataFile ) ;
314+ }
297315 }
298316 return true ;
299317 }
0 commit comments