Fix wxDocManager::GetLastDirectory() when there is no history.
The most recently opened file should be used only if we have MRU list. Closes #11145. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61766 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -991,9 +991,9 @@ wxString wxDocManager::GetLastDirectory() const
|
|||||||
// this ensures that if the user opens a file, closes the program and
|
// this ensures that if the user opens a file, closes the program and
|
||||||
// runs it again the "Open file" dialog will open in the directory of
|
// runs it again the "Open file" dialog will open in the directory of
|
||||||
// the last file he used
|
// the last file he used
|
||||||
wxString lastOpened = GetHistoryFile(0);
|
if ( m_fileHistory && m_fileHistory->GetCount() )
|
||||||
if ( !lastOpened.empty() )
|
|
||||||
{
|
{
|
||||||
|
const wxString lastOpened = m_fileHistory->GetHistoryFile(0);
|
||||||
const wxFileName fn(lastOpened);
|
const wxFileName fn(lastOpened);
|
||||||
if ( fn.DirExists() )
|
if ( fn.DirExists() )
|
||||||
{
|
{
|
||||||
@@ -1001,6 +1001,7 @@ wxString wxDocManager::GetLastDirectory() const
|
|||||||
}
|
}
|
||||||
//else: should we try the next one?
|
//else: should we try the next one?
|
||||||
}
|
}
|
||||||
|
//else: no history yet
|
||||||
|
|
||||||
// if we don't have any files in the history (yet?), use the
|
// if we don't have any files in the history (yet?), use the
|
||||||
// system-dependent default location for the document files
|
// system-dependent default location for the document files
|
||||||
|
Reference in New Issue
Block a user