Correctly rename g-code file once it is generated.

This commit is contained in:
bubnikv 2017-02-28 10:44:44 +01:00
parent 80f345d7c1
commit 46fc4a0a8e

View File

@ -101,7 +101,15 @@ sub export_gcode {
# close our gcode file
close $fh;
rename $tempfile, $output_file if $tempfile;
if ($tempfile) {
my $i;
for ($i = 0; $i < 5; $i += 1) {
last if (rename Slic3r::encode_path($tempfile), Slic3r::encode_path($file));
# Wait for 1/4 seconds and try to rename once again.
select(undef, undef, undef, 0.25);
}
Slic3r::debugf "Failed to remove the output G-code file from $tempfile to $file. Is $tempfile locked?\n" if ($i == 5);
}
}
# run post-processing scripts