On Mon, Nov 12, 2001 at 06:38:54AM -0800, [EMAIL PROTECTED] wrote:

> Initial Comment:
> To show this behaviour:
> 
> 1. Open the file browser (e.g. File | Open)
> 2. In the directory entry, type a directory which has
> subdirs, then press Enter (eg. /usr/include)
> 3. You are now shown the content of the directory
> chosen. Now, type an invalid subdir name (e.g. foo).
> 4. You are brought back to your home directory.
> 
> If your path is shot, it doesn't matter much but with
> long path names, it's a nightmare. This happens with
> the xforms verions of lyx, I haven't tried the others.

fix attached. please apply.

thanks
john

-- 
"I know I believe in nothing but it is my nothing"
        - Manic Street Preachers
Index: src/frontends/xforms/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.193
diff -u -r1.193 ChangeLog
--- src/frontends/xforms/ChangeLog      2001/11/05 17:07:23     1.193
+++ src/frontends/xforms/ChangeLog      2001/11/12 15:56:02
@@ -1,3 +1,12 @@
+2001-11-12  John Levon  <[EMAIL PROTECTED]>
+
+       * FormFiledialog.C: don't reset path if new dir
+         doesn't exist.
+ 
+2001-11-07  John Levon  <[EMAIL PROTECTED]>
+
+       * DropDown.C: fix crash, improve behaviour a bit
+ 
 2001-11-03  John Levon  <[EMAIL PROTECTED]>
 
        * Makefile.am:
Index: src/frontends/xforms/FormFiledialog.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormFiledialog.C,v
retrieving revision 1.10
diff -u -r1.10 FormFiledialog.C
--- src/frontends/xforms/FormFiledialog.C       2001/09/09 22:02:16     1.10
+++ src/frontends/xforms/FormFiledialog.C       2001/11/12 15:56:02
@@ -376,11 +376,24 @@
 // SetDirectory: sets dialog current directory
 void FileDialog::Private::SetDirectory(string const & Path)
 {
+       string tmp;
+ 
        if (!pszDirectory.empty()) {
                string TempPath = ExpandPath(Path); // Expand ~/
                TempPath = MakeAbsPath(TempPath, pszDirectory);
-               pszDirectory = MakeAbsPath(TempPath);
-       } else pszDirectory = MakeAbsPath(Path);
+               tmp = MakeAbsPath(TempPath);
+       } else {
+               tmp = MakeAbsPath(Path);
+       }
+ 
+       // must check the directory exists
+       DIR * pDirectory = ::opendir(tmp.c_str());
+       if (!pDirectory) {
+               WriteFSAlert(_("Warning! Couldn't open directory."), tmp);
+       } else {
+               ::closedir(pDirectory);
+               pszDirectory = tmp;
+       }
 }
 
 

Reply via email to