src/solaris/classes/sun/awt/X11/XFileDialogPeer.java

Print this page




 703      * We cann't update savedDir here now since it used very often
 704      */
 705     public void setDirectory(String dir) {
 706 
 707         if (dir == null) {
 708             this.dir = null;
 709             return;
 710         }
 711 
 712         if (dir.equals(this.dir)) {
 713             return;
 714         }
 715 
 716         int i;
 717         if ((i=dir.indexOf("~")) != -1) {
 718 
 719             dir = dir.substring(0,i) + System.getProperty("user.home") + dir.substring(i+1,dir.length());
 720         }
 721 
 722         File fe = new File(dir).getAbsoluteFile();

 723         log.fine("Current directory : " + fe);

 724 
 725         if (!fe.isDirectory()) {
 726             dir = "./";
 727             fe = new File(dir).getAbsoluteFile();
 728 
 729             if (!fe.isDirectory()) {
 730                 return;
 731             }
 732         }
 733         try {
 734             dir = this.dir = fe.getCanonicalPath();
 735         } catch (java.io.IOException ie) {
 736             dir = this.dir = fe.getAbsolutePath();
 737         }
 738         pathField.setText(this.dir);
 739 
 740 
 741         if (dir.endsWith("/")) {
 742             this.dir = dir;
 743             handleFilter("");




 703      * We cann't update savedDir here now since it used very often
 704      */
 705     public void setDirectory(String dir) {
 706 
 707         if (dir == null) {
 708             this.dir = null;
 709             return;
 710         }
 711 
 712         if (dir.equals(this.dir)) {
 713             return;
 714         }
 715 
 716         int i;
 717         if ((i=dir.indexOf("~")) != -1) {
 718 
 719             dir = dir.substring(0,i) + System.getProperty("user.home") + dir.substring(i+1,dir.length());
 720         }
 721 
 722         File fe = new File(dir).getAbsoluteFile();
 723         if (log.isLoggable(PlatformLogger.FINE)) {
 724             log.fine("Current directory : " + fe);
 725         }
 726 
 727         if (!fe.isDirectory()) {
 728             dir = "./";
 729             fe = new File(dir).getAbsoluteFile();
 730 
 731             if (!fe.isDirectory()) {
 732                 return;
 733             }
 734         }
 735         try {
 736             dir = this.dir = fe.getCanonicalPath();
 737         } catch (java.io.IOException ie) {
 738             dir = this.dir = fe.getAbsolutePath();
 739         }
 740         pathField.setText(this.dir);
 741 
 742 
 743         if (dir.endsWith("/")) {
 744             this.dir = dir;
 745             handleFilter("");