Skip to content

Commit

Permalink
Fix wxRmdir() with non-ASCII paths
Browse files Browse the repository at this point in the history
Don't apply at best unnecessary, and actually harmful, as it uses a wrong
conversion, fn_str() when calling wxRmDir() which takes wxString.

Update unit tests to check that wxRmdir() now works with non-ASCII filenames
too.

Closes wxWidgets#17644.
  • Loading branch information
vadz committed Apr 1, 2017
1 parent d145ef7 commit e9ce55e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ All:
wxEvtHandler and/or wxTrackable in C++11 code (Raul Tambre, mmarsan).
- Update bundled expat to 2.2.0 (Catalin Raceanu).
- Add wxCMD_LINE_HIDDEN wxCmdLineParser flag (Lauri Nurmi).
- Fix wxRmdir() with non-ASCII paths (trivia21).
- Don't crash in wxFFile::Eof() or Error() on closed file (jprotopopov).

All (GUI):
Expand Down
2 changes: 1 addition & 1 deletion src/common/debugrpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ wxDebugReport::~wxDebugReport()

if ( !m_dir.empty() )
{
if ( wxRmDir(m_dir.fn_str()) != 0 )
if ( wxRmDir(m_dir) != 0 )
{
wxLogSysError(_("Failed to clean up debug report directory \"%s\""),
m_dir.c_str());
Expand Down
2 changes: 1 addition & 1 deletion src/common/filefn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ bool wxRmdir(const wxString& dir, int WXUNUSED(flags))
#if defined(__VMS__)
return false; //to be changed since rmdir exists in VMS7.x
#else
if ( wxRmDir(dir.fn_str()) != 0 )
if ( wxRmDir(dir) != 0 )
{
wxLogSysError(_("Directory '%s' couldn't be deleted"), dir);
return false;
Expand Down
4 changes: 2 additions & 2 deletions tests/file/filefn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ void FileFunctionsTestCase::PathOnly()
// Rmdir fails on them on Linux. See ticket #17644.
void FileFunctionsTestCase::Mkdir()
{
wxString dirname = wxT("__wxMkdir_test_dir");
wxString dirname = wxString::FromUTF8("__wxMkdir_test_dir_with_\xc3\xb6");
const std::string msg = wxString::Format("Dir: %s", dirname).ToStdString();
CPPUNIT_ASSERT_MESSAGE( msg, wxMkdir(dirname) );
CPPUNIT_ASSERT_MESSAGE( msg, wxDirExists(dirname) );
Expand All @@ -533,7 +533,7 @@ void FileFunctionsTestCase::Mkdir()

void FileFunctionsTestCase::Rmdir()
{
wxString dirname = wxT("__wxRmdir_test_dir");
wxString dirname = wxString::FromUTF8("__wxRmdir_test_dir_with_\xc3\xb6");
const std::string msg = wxString::Format("Dir: %s", dirname).ToStdString();

CPPUNIT_ASSERT_MESSAGE( msg, wxMkdir(dirname) );
Expand Down

0 comments on commit e9ce55e

Please sign in to comment.