Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onCompilerComboChange(event:Event):Void
- {
- compilerPath = event.currentTarget.selectedItem.label;
- updateSettings();
- }
- function onSourceCompileClick(event:MouseEvent)
- {
- processReady = false;
- Alert.show("compiling source code...");
- var file = File.applicationStorageDirectory.resolvePath(config.sourceFile);
- var stream = new FileStream();
- stream.open(file, FileMode.WRITE );
- stream.writeUTFBytes(source.text);
- stream.close();
- if(NativeProcess.isSupported)
- {
- var file:File = new File(compilerPath);
- var processInfo = new NativeProcessStartupInfo();
- processInfo.executable = file;
- processInfo.arguments = Vector.ofArray(config.compilerArgs);
- processInfo.workingDirectory = File.applicationStorageDirectory;
- var process:NativeProcess = new NativeProcess();
- process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
- process.addEventListener(ProgressEvent.STANDARD_INPUT_PROGRESS, inputProgressListener);
- process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onErrorData);
- process.addEventListener(NativeProcessExitEvent.EXIT, onCompileComplete);
- process.start(processInfo);
- }
- else
- {
- Alert.show("Cannot compile. NativeProcess is not Supported in this mode.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment