681 * We cann't update savedDir here now since it used very often
682 */
683 public void setDirectory(String dir) {
684
685 if (dir == null) {
686 this.dir = null;
687 return;
688 }
689
690 if (dir.equals(this.dir)) {
691 return;
692 }
693
694 int i;
695 if ((i=dir.indexOf("~")) != -1) {
696
697 dir = dir.substring(0,i) + System.getProperty("user.home") + dir.substring(i+1,dir.length());
698 }
699
700 File fe = new File(dir).getAbsoluteFile();
701 log.fine("Current directory : " + fe);
702
703 if (!fe.isDirectory()) {
704 dir = "./";
705 fe = new File(dir).getAbsoluteFile();
706
707 if (!fe.isDirectory()) {
708 return;
709 }
710 }
711 try {
712 dir = this.dir = fe.getCanonicalPath();
713 } catch (java.io.IOException ie) {
714 dir = this.dir = fe.getAbsolutePath();
715 }
716 pathField.setText(this.dir);
717
718
719 if (dir.endsWith("/")) {
720 this.dir = dir;
721 handleFilter("");
|
681 * We cann't update savedDir here now since it used very often
682 */
683 public void setDirectory(String dir) {
684
685 if (dir == null) {
686 this.dir = null;
687 return;
688 }
689
690 if (dir.equals(this.dir)) {
691 return;
692 }
693
694 int i;
695 if ((i=dir.indexOf("~")) != -1) {
696
697 dir = dir.substring(0,i) + System.getProperty("user.home") + dir.substring(i+1,dir.length());
698 }
699
700 File fe = new File(dir).getAbsoluteFile();
701 if (log.isLoggable(Level.FINE)) {
702 log.fine("Current directory : " + fe);
703 }
704
705 if (!fe.isDirectory()) {
706 dir = "./";
707 fe = new File(dir).getAbsoluteFile();
708
709 if (!fe.isDirectory()) {
710 return;
711 }
712 }
713 try {
714 dir = this.dir = fe.getCanonicalPath();
715 } catch (java.io.IOException ie) {
716 dir = this.dir = fe.getAbsolutePath();
717 }
718 pathField.setText(this.dir);
719
720
721 if (dir.endsWith("/")) {
722 this.dir = dir;
723 handleFilter("");
|