mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Bugfix: crash when reading/writing files to paths containing non-ASCII characters on Windows. #651 #865
This commit is contained in:
		
							parent
							
								
									73aae07e74
								
							
						
					
					
						commit
						ad9be0e4d7
					
				
					 8 changed files with 20 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -13,7 +13,7 @@ sub read_file {
 | 
			
		|||
    	1;
 | 
			
		||||
    } or die "AMF parsing requires XML::SAX\n";
 | 
			
		||||
    
 | 
			
		||||
    open my $fh, '<', $file or die "Failed to open $file\n";
 | 
			
		||||
    Slic3r::open(\my $fh, '<', $file) or die "Failed to open $file\n";
 | 
			
		||||
    
 | 
			
		||||
    my $model = Slic3r::Model->new;
 | 
			
		||||
    XML::SAX::ParserFactory
 | 
			
		||||
| 
						 | 
				
			
			@ -30,7 +30,7 @@ sub write_file {
 | 
			
		|||
    
 | 
			
		||||
    my %vertices_offset = ();
 | 
			
		||||
    
 | 
			
		||||
    open my $fh, '>', $file;
 | 
			
		||||
    Slic3r::open(\my $fh, '>', $file);
 | 
			
		||||
    binmode $fh, ':utf8';
 | 
			
		||||
    printf $fh qq{<?xml version="1.0" encoding="UTF-8"?>\n};
 | 
			
		||||
    printf $fh qq{<amf unit="millimeter">\n};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ sub read_file {
 | 
			
		|||
    my $self = shift;
 | 
			
		||||
    my ($file) = @_;
 | 
			
		||||
    
 | 
			
		||||
    open my $fh, '<', $file or die "Failed to open $file\n";
 | 
			
		||||
    Slic3r::open(\my $fh, '<', $file) or die "Failed to open $file\n";
 | 
			
		||||
    my $vertices = [];
 | 
			
		||||
    my $facets = [];
 | 
			
		||||
    while (my $_ = <$fh>) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,7 @@ sub read_file {
 | 
			
		|||
    my $self = shift;
 | 
			
		||||
    my ($file) = @_;
 | 
			
		||||
    
 | 
			
		||||
    open my $fh, '<', $file or die "Failed to open $file\n";
 | 
			
		||||
    Slic3r::open(\my $fh, '<', $file) or die "Failed to open $file\n";
 | 
			
		||||
    
 | 
			
		||||
    # let's detect whether file is ASCII or binary
 | 
			
		||||
    my $mode;
 | 
			
		||||
| 
						 | 
				
			
			@ -103,7 +103,7 @@ sub write_file {
 | 
			
		|||
    my $self = shift;
 | 
			
		||||
    my ($file, $model, %params) = @_;
 | 
			
		||||
    
 | 
			
		||||
    open my $fh, '>', $file;
 | 
			
		||||
    Slic3r::open(\my $fh, '>', $file);
 | 
			
		||||
    
 | 
			
		||||
    $params{binary}
 | 
			
		||||
        ? _write_binary($fh, $model->mesh)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue