1 2 3 4 5 6 7 8 9 10 11
use 5.12.0; use warnings; use Wx qw( wxID_OK ); my $dlg = Wx::FileDialog->new( undef ); exit unless $dlg->ShowModal == wxID_OK; my $path = $dlg->GetPath; say $path; say -e $path ? 1 : 0;
1 2 3 4 5 6 7 8 9 10 11 12 13 14
use 5.12.0; use warnings; use Wx qw( wxID_OK ); use Encode; my $dlg = Wx::FileDialog->new( undef ); exit unless $dlg->ShowModal == wxID_OK; my $path = $dlg->GetPath; $path = Encode::encode( 'cp1252', $path ); say $path; say -e $path ? 1 : 0;
1 2 3 4 5 6 7 8 9 10 11 12 13
package ...::Util ... use Encode; ... sub clean_path { return $^O eq 'Win32' ? Encode::encode( 'cp1252', shift ) : shift ; } ...