Avoid warnings about not checking chdir() result in wxGTK.
Give error if changing directory when wxFD_CHANGE_DIR or wxDIRP_CHANGE_DIR flags are used, this is a good idea generally speaking and it also avoids warnings about not checking chdir() return value that we got under Ubuntu. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78480 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -81,7 +81,10 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog)
|
|||||||
{
|
{
|
||||||
// Use chdir to not care about filename encodings
|
// Use chdir to not care about filename encodings
|
||||||
wxGtkString folder(g_path_get_dirname(filename));
|
wxGtkString folder(g_path_get_dirname(filename));
|
||||||
chdir(folder);
|
if ( chdir(folder) != 0 )
|
||||||
|
{
|
||||||
|
wxLogSysError(_("Changing current directory to \"%s\" failed"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCommandEvent event(wxEVT_BUTTON, wxID_OK);
|
wxCommandEvent event(wxEVT_BUTTON, wxID_OK);
|
||||||
|
@@ -180,7 +180,12 @@ static void file_set(GtkFileChooser* widget, wxDirButton* p)
|
|||||||
// thus we need to make sure the current working directory is updated if wxDIRP_CHANGE_DIR
|
// thus we need to make sure the current working directory is updated if wxDIRP_CHANGE_DIR
|
||||||
// style was given.
|
// style was given.
|
||||||
if (p->HasFlag(wxDIRP_CHANGE_DIR))
|
if (p->HasFlag(wxDIRP_CHANGE_DIR))
|
||||||
chdir(filename);
|
{
|
||||||
|
if ( chdir(filename) != 0 )
|
||||||
|
{
|
||||||
|
wxLogSysError(_("Changing current directory to \"%s\" failed"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ...and fire an event
|
// ...and fire an event
|
||||||
wxFileDirPickerEvent event(wxEVT_DIRPICKER_CHANGED, p, p->GetId(), p->GetPath());
|
wxFileDirPickerEvent event(wxEVT_DIRPICKER_CHANGED, p, p->GetId(), p->GetPath());
|
||||||
|
Reference in New Issue
Block a user