os.cp: fix returning false error on Windows (#6037)
							parent
							
								
									7f447bb82f
								
							
						
					
					
						commit
						8dcc3cda97
					
				| 
						 | 
				
			
			@ -75,9 +75,8 @@ pub fn cp(old, new string) ? {
 | 
			
		|||
	$if windows {
 | 
			
		||||
		w_old := old.replace('/', '\\')
 | 
			
		||||
		w_new := new.replace('/', '\\')
 | 
			
		||||
		C.CopyFile(w_old.to_wide(), w_new.to_wide(), false)
 | 
			
		||||
		if C.CopyFile(w_old.to_wide(), w_new.to_wide(), false) == 0 {
 | 
			
		||||
			result := C.GetLastError()
 | 
			
		||||
		if result != 0 {
 | 
			
		||||
			return error_with_code('failed to copy $old to $new', int(result))
 | 
			
		||||
		}
 | 
			
		||||
	} $else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue