Pass proper argument to wxFileDialog

File name only should be passed for `defaultFile' parameter otherwise
assertion in wxFileName::Assign() fails ("the file name shouldn't
contain the path").
This commit is contained in:
Artur Wieczorek
2020-04-17 23:18:06 +02:00
parent 5236801241
commit fbafe74414

View File

@@ -2191,9 +2191,9 @@ bool wxFileProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value)
{
wxASSERT_MSG(value.IsType(wxS("string")), "Function called for incompatible property");
wxString strVal = value.GetString();
wxFileName filename = strVal;
wxFileName filename(value.GetString());
wxString path = filename.GetPath();
wxString file = filename.GetFullName();
if ( path.empty() && !m_basePath.empty() )
path = m_basePath;
@@ -2201,7 +2201,7 @@ bool wxFileProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value)
wxFileDialog dlg(pg->GetPanel(),
m_dlgTitle.empty() ? _("Choose a file") : m_dlgTitle,
m_initialPath.empty() ? path : m_initialPath,
strVal,
file,
m_wildcard.empty() ? wxALL_FILES : m_wildcard,
m_dlgStyle,
wxDefaultPosition);