Opened 6 years ago

Closed 6 years ago

#14886 closed defect (fixed)

Use wxSetWorkingDirectory() instead of chdir() with wxString paths

Reported by: kosenko Owned by: vadz
Priority: normal Milestone:
Component: wxGTK Version: stable-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: yes


In GTK+ porn with WIN32 backend wxString::fn_str() returns wchar_t strings that are not compatible with chdir(const char *) function.

With applied patch behavior under Linux will not changed and under Windows modified code will work as ::SetCurrentDirectory(m_selectedDirectory.t_str());

Code was broken in r72780 (r72779)

Attachments (1)

gtk_win32_dirdlg_cwd.diff download (667 bytes) - added by kosenko 6 years ago.

Download all attachments as: .zip

Change History (3)

Changed 6 years ago by kosenko

comment:1 Changed 6 years ago by vadz

  • Owner set to vadz
  • Status changed from new to accepted

I'm OK with this patch and will apply it but I wonder if we shouldn't have wxChdir() for consistency (which would map to chdir/_chdir/_wchdir).

comment:2 Changed 6 years ago by VZ

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [73160]) Use wxSetWorkingDirectory() instead of chdir().

This fixes compilation of wxGTK under Windows after the changes of r72779 and
r72780, where _wchdir() would need to be used but we don't currently have a
wxChdir() CRT function wrapper so use wxSetWorkingDirectory() instead.

Closes #14886.

Note: See TracTickets for help on using tickets.