fix file dialog bug

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3010 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2001-11-12 16:12:48 +00:00
parent fb16a10b8e
commit f06372807d
2 changed files with 20 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2001-11-12 John Levon <moz@compsoc.man.ac.uk>
* FormFiledialog.C: don't reset path if new dir
doesn't exist.
2001-11-12 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* forms/form_document.fd: Renamed "Save as Class Defaults"

View File

@ -376,11 +376,24 @@ void FileDialog::Private::Reread()
// 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;
}
}