X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9c8849722a71ee7139e035bca5fdb2ae7b0af570..311227c3fe69ac4d3f45999c2234d8276cf5e761:/src/generic/filedlgg.cpp diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index 39642ac8dd..c169071d01 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -37,12 +37,13 @@ #include "wx/tooltip.h" #endif -#include "sys/types.h" -#include "sys/stat.h" -#include "dirent.h" -#include "pwd.h" -#include "grp.h" -#include "time.h" +#include +#include +#include +#include +#include +#include +#include #include "wx/generic/home.xpm" #include "wx/generic/listview.xpm" @@ -560,7 +561,11 @@ wxFileDialog::wxFileDialog(wxWindow *parent, m_message = message; m_dialogStyle = style; m_dir = defaultDir; - if (m_dir.IsEmpty()) m_dir = wxGetUserHome(); + if (m_dir.IsEmpty()) + { + char buf[200]; + m_dir = getcwd( buf, sizeof(buf) ); + } m_path = defaultDir; m_path += _T("/"); m_path += defaultFile; @@ -670,8 +675,11 @@ wxFileDialog::wxFileDialog(wxWindow *parent, mainsizer->SetSizeHints( this ); Centre( wxBOTH ); - - m_list->SetFocus(); + + if (m_fileName.IsEmpty()) + m_list->SetFocus(); + else + m_text->SetFocus(); wxEndBusyCursor(); } @@ -723,6 +731,24 @@ void wxFileDialog::OnListOk( wxCommandEvent &event ) return; } + if (filename == _T("~")) + { + m_list->GoToHomeDir(); + m_list->SetFocus(); + m_list->GetDir( dir ); + m_static->SetLabel( dir ); + return; + } + + if (filename[0] == _T('~')) + { + filename.Remove( 0, 1 ); + wxString tmp( wxGetUserHome() ); + tmp += _T('/'); + tmp += filename; + filename = tmp; + } + if ((filename.Find(_T('*')) != wxNOT_FOUND) || (filename.Find(_T('?')) != wxNOT_FOUND)) { @@ -736,13 +762,19 @@ void wxFileDialog::OnListOk( wxCommandEvent &event ) } if (dir != _T("/")) dir += _T("/"); - dir += filename; - filename = dir; + if (filename[0] != _T('/')) + { + dir += filename; + filename = dir; + } if (wxDirExists(filename)) { m_list->GoToDir( filename ); - m_text->SetValue( _T("..") ); + if (filename == _T("/")) + m_text->SetValue( _T("") ); + else + m_text->SetValue( _T("..") ); m_list->GetDir( dir ); m_static->SetLabel( dir ); return;