Write fatal errors to console as well
This commit is contained in:
parent
40ce69ce5c
commit
28d7b0dba6
@ -82,9 +82,13 @@ sub OnInit {
|
|||||||
# just checking for existence of $datadir is not enough: it may be an empty directory
|
# just checking for existence of $datadir is not enough: it may be an empty directory
|
||||||
# supplied as argument to --datadir; in that case we should still run the wizard
|
# supplied as argument to --datadir; in that case we should still run the wizard
|
||||||
my $run_wizard = (-d $enc_datadir && -e "$enc_datadir/slic3r.ini") ? 0 : 1;
|
my $run_wizard = (-d $enc_datadir && -e "$enc_datadir/slic3r.ini") ? 0 : 1;
|
||||||
for ($enc_datadir, "$enc_datadir/print", "$enc_datadir/filament", "$enc_datadir/printer") {
|
foreach my $dir ($enc_datadir, "$enc_datadir/print", "$enc_datadir/filament", "$enc_datadir/printer") {
|
||||||
mkdir or $self->fatal_error("Slic3r was unable to create its data directory at $_ (errno: $!).")
|
next if -d $dir;
|
||||||
unless -d $_;
|
if (!mkdir $dir) {
|
||||||
|
my $error = "Slic3r was unable to create its data directory at $dir ($!).";
|
||||||
|
warn "$error\n";
|
||||||
|
fatal_error(undef, $error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# load settings
|
# load settings
|
||||||
@ -161,22 +165,19 @@ sub catch_error {
|
|||||||
|
|
||||||
# static method accepting a wxWindow object as first parameter
|
# static method accepting a wxWindow object as first parameter
|
||||||
sub show_error {
|
sub show_error {
|
||||||
my $self = shift;
|
my ($parent, $message) = @_;
|
||||||
my ($message) = @_;
|
Wx::MessageDialog->new($parent, $message, 'Error', wxOK | wxICON_ERROR)->ShowModal;
|
||||||
Wx::MessageDialog->new($self, $message, 'Error', wxOK | wxICON_ERROR)->ShowModal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# static method accepting a wxWindow object as first parameter
|
# static method accepting a wxWindow object as first parameter
|
||||||
sub show_info {
|
sub show_info {
|
||||||
my $self = shift;
|
my ($parent, $message, $title) = @_;
|
||||||
my ($message, $title) = @_;
|
Wx::MessageDialog->new($parent, $message, $title || 'Notice', wxOK | wxICON_INFORMATION)->ShowModal;
|
||||||
Wx::MessageDialog->new($self, $message, $title || 'Notice', wxOK | wxICON_INFORMATION)->ShowModal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# static method accepting a wxWindow object as first parameter
|
# static method accepting a wxWindow object as first parameter
|
||||||
sub fatal_error {
|
sub fatal_error {
|
||||||
my $self = shift;
|
show_error(@_);
|
||||||
$self->show_error(@_);
|
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user