From a8a6bf6a0760801337918744ce1505d0a0b5a420 Mon Sep 17 00:00:00 2001 From: "Zane U. Ji" Date: Thu, 5 Jun 2014 21:43:34 +0800 Subject: [PATCH] Fixed a file URI problem --- src/associatedialog.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/associatedialog.cpp b/src/associatedialog.cpp index 18ba6a4..3040f5b 100644 --- a/src/associatedialog.cpp +++ b/src/associatedialog.cpp @@ -19,6 +19,7 @@ #include #include "associatedialog.h" +#include "wraplibxml.h" BEGIN_EVENT_TABLE ( AssociateDialog, wxDialog ) EVT_BUTTON ( wxID_OK, AssociateDialog::OnOk ) @@ -160,16 +161,16 @@ void AssociateDialog::OnBrowse ( wxCommandEvent& e ) { wxString extensionArgument; extensionArgument = - type + - _T ( " (" ) + - extension + - _T ( ")|" ) + - extension + - _ ( "|All files (*.*)|*.*" ); + type + _T ( " (" ) + extension + _T ( ")|" ) + extension + + _ ( "|All files (*.*)|*.*" ); + wxFileName fileName = WrapLibxml::URLToFileName ( urlCtrl->GetValue() ); + wxString dir = fileName.GetPath(); + if ( dir.empty() && mLastDir ) + dir = *mLastDir; std::auto_ptr fd ( new wxFileDialog ( this, _ ( "Select " ) + type, - mLastDir ? *mLastDir : _T ( "" ), + dir, _T ( "" ), extensionArgument, #if wxCHECK_VERSION(2,9,0) @@ -181,7 +182,7 @@ void AssociateDialog::OnBrowse ( wxCommandEvent& e ) if ( fd->ShowModal() == wxID_OK ) { - wxString newValue = fd->GetPath(); + wxString newValue = WrapLibxml::FileNameToURL ( fd->GetPath() ); urlCtrl->SetValue ( newValue ); if ( mLastDir )