comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet33.d @ 112:9f4c18c268b2

Update to compile and execute with dmd 2.052.
author kntroh
date Wed, 16 Mar 2011 21:53:53 +0900
parents 69b1fa94a4a8
children 536e43f63c81
comparison
equal deleted inserted replaced
111:b6e9904989ed 112:9f4c18c268b2
20 */ 20 */
21 21
22 import org.eclipse.swt.widgets.DirectoryDialog; 22 import org.eclipse.swt.widgets.DirectoryDialog;
23 import org.eclipse.swt.widgets.Display; 23 import org.eclipse.swt.widgets.Display;
24 import org.eclipse.swt.widgets.Shell; 24 import org.eclipse.swt.widgets.Shell;
25 import java.lang.all;
25 26
26 import tango.io.FileSystem; 27 version(Tango){
27 import tango.io.Stdout; 28 import tango.sys.Environment;
28 import tango.util.Convert; 29 import tango.io.Stdout;
30 import tango.util.Convert;
31 } else { // Phobos
32 import std.file;
33 import std.stdio;
34 import std.conv;
35 }
29 36
30 void main () { 37 void main () {
31 auto display = new Display (); 38 auto display = new Display ();
32 auto shell = new Shell (display); 39 auto shell = new Shell (display);
33 shell.open (); 40 shell.open ();
34 auto dialog = new DirectoryDialog (shell); 41 auto dialog = new DirectoryDialog (shell);
35 dialog.setFilterPath (FileSystem.getDirectory()); 42 version(Tango){
36 Stdout("RESULT=" ~ to!(char[])(dialog.open())).newline; 43 dialog.setFilterPath (Environment.cwd());
44 Stdout("RESULT=" ~ to!(String)(dialog.open())).newline;
45 } else {
46 dialog.setFilterPath (getcwd());
47 writeln("RESULT=" ~ to!(String)(dialog.open()));
48 }
37 while (!shell.isDisposed()) { 49 while (!shell.isDisposed()) {
38 if (!display.readAndDispatch ()) display.sleep (); 50 if (!display.readAndDispatch ()) display.sleep ();
39 } 51 }
40 display.dispose (); 52 display.dispose ();
41 } 53 }