From a3be9218fd497d9a8320b7bed16874945d1687ff Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Wed, 28 Dec 2016 15:55:14 -0800 Subject: [PATCH] Now Mac file dialogs work in a background thread --- lime/ui/FileDialog.hx | 100 ------------------------------------------ 1 file changed, 100 deletions(-) diff --git a/lime/ui/FileDialog.hx b/lime/ui/FileDialog.hx index 3367423d8..d81bbd779 100644 --- a/lime/ui/FileDialog.hx +++ b/lime/ui/FileDialog.hx @@ -41,7 +41,6 @@ class FileDialog { if (type == null) type = FileDialogType.OPEN; #if desktop - #if !mac var worker = new BackgroundWorker (); @@ -107,61 +106,6 @@ class FileDialog { worker.run (); - #else - - var path:String = null; - var paths:Array = null; - - switch (type) { - - case OPEN: - - path = lime_file_dialog_open_file (filter, defaultPath); - - case OPEN_DIRECTORY: - - path = lime_file_dialog_open_directory (filter, defaultPath); - - case OPEN_MULTIPLE: - - paths = lime_file_dialog_open_files (filter, defaultPath); - - case SAVE: - - path = lime_file_dialog_save_file (filter, defaultPath); - - } - - switch (type) { - - case OPEN, OPEN_DIRECTORY, SAVE: - - if (path != null) { - - onSelect.dispatch (path); - - } else { - - onCancel.dispatch (); - - } - - case OPEN_MULTIPLE: - - if (paths != null && paths.length > 0) { - - onSelectMultiple.dispatch (paths); - - } else { - - onCancel.dispatch (); - - } - - } - - #end - return true; #else @@ -177,7 +121,6 @@ class FileDialog { public function open (filter:String = null, defaultPath:String = null):Bool { #if desktop - #if !mac var worker = new BackgroundWorker (); @@ -207,28 +150,6 @@ class FileDialog { worker.run (); - #else - - // Doesn't work in a thread - - var path:String = lime_file_dialog_open_file (filter, defaultPath); - - if (path != null) { - - try { - - var data = File.getBytes (path); - onOpen.dispatch (data); - return true; - - } catch (e:Dynamic) {} - - } - - onCancel.dispatch (); - - #end - return true; #else @@ -244,7 +165,6 @@ class FileDialog { public function save (data:Resource, filter:String = null, defaultPath:String = null):Bool { #if desktop - #if !mac var worker = new BackgroundWorker (); @@ -274,26 +194,6 @@ class FileDialog { worker.run (); - #else - - var path:String = lime_file_dialog_save_file (filter, defaultPath); - - if (path != null) { - - try { - - File.saveBytes (path, data); - onSave.dispatch (path); - return true; - - } catch (e:Dynamic) {} - - } - - onCancel.dispatch (); - - #end - return true; #else