mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Allow to supply custom G-code via command line if file is not found
This commit is contained in:
		
							parent
							
								
									2d687cd0a0
								
							
						
					
					
						commit
						8ea4ed3b5e
					
				
					 1 changed files with 7 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -1071,13 +1071,13 @@ sub new_from_cli {
 | 
			
		|||
    for (qw(start end layer toolchange)) {
 | 
			
		||||
        my $opt_key = "${_}_gcode";
 | 
			
		||||
        if ($args{$opt_key}) {
 | 
			
		||||
            die "Invalid value for --${_}-gcode: file does not exist\n"
 | 
			
		||||
                if !-e $args{$opt_key};
 | 
			
		||||
            Slic3r::open(\my $fh, "<", $args{$opt_key})
 | 
			
		||||
                or die "Failed to open $args{$opt_key}\n";
 | 
			
		||||
            binmode $fh, ':utf8';
 | 
			
		||||
            $args{$opt_key} = do { local $/; <$fh> };
 | 
			
		||||
            close $fh;
 | 
			
		||||
            if (-e $args{$opt_key}) {
 | 
			
		||||
                Slic3r::open(\my $fh, "<", $args{$opt_key})
 | 
			
		||||
                    or die "Failed to open $args{$opt_key}\n";
 | 
			
		||||
                binmode $fh, ':utf8';
 | 
			
		||||
                $args{$opt_key} = do { local $/; <$fh> };
 | 
			
		||||
                close $fh;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue