jan_flanders

Untitled

May 24th, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function onCompilerComboChange(event:Event):Void
  2.     {
  3.         compilerPath = event.currentTarget.selectedItem.label;
  4.         updateSettings();
  5.     }
  6.    
  7.     function onSourceCompileClick(event:MouseEvent)
  8.     {
  9.         processReady = false;
  10.         Alert.show("compiling source code...");
  11.  
  12.         var file = File.applicationStorageDirectory.resolvePath(config.sourceFile);
  13.        
  14.         var stream = new FileStream();
  15.         stream.open(file, FileMode.WRITE );
  16.         stream.writeUTFBytes(source.text);
  17.         stream.close();
  18.         if(NativeProcess.isSupported)
  19.         {
  20.             var file:File = new File(compilerPath);
  21.            
  22.             var processInfo = new NativeProcessStartupInfo();
  23.             processInfo.executable = file;
  24.             processInfo.arguments = Vector.ofArray(config.compilerArgs);
  25.             processInfo.workingDirectory = File.applicationStorageDirectory;
  26.            
  27.             var process:NativeProcess = new NativeProcess();
  28.             process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
  29.             process.addEventListener(ProgressEvent.STANDARD_INPUT_PROGRESS, inputProgressListener);
  30.             process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onErrorData);
  31.             process.addEventListener(NativeProcessExitEvent.EXIT, onCompileComplete);
  32.             process.start(processInfo);        
  33.         }
  34.         else
  35.         {
  36.             Alert.show("Cannot compile. NativeProcess is not Supported in this mode.");
  37.         }
  38.     }
Advertisement
Add Comment
Please, Sign In to add comment