mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 19:24:57 +08:00
Merge pull request #1399 from Riey/stdlib-os-symlink-windows
Fix os_symlink compile error on windows
This commit is contained in:
1 file changed
+4
-4
+4
-4
@@ -853,17 +853,17 @@ fn os_symlink(
|
||||
vm: &VirtualMachine,
|
||||
) -> PyResult<()> {
|
||||
use std::os::windows::fs as win_fs;
|
||||
let ret = match fs::metadata(&dst.value) {
|
||||
let ret = match fs::metadata(dst.as_str()) {
|
||||
Ok(meta) => {
|
||||
if meta.is_file() {
|
||||
win_fs::symlink_file(&src.value, &dst.value)
|
||||
win_fs::symlink_file(src.as_str(), dst.as_str())
|
||||
} else if meta.is_dir() {
|
||||
win_fs::symlink_dir(&src.value, &dst.value)
|
||||
win_fs::symlink_dir(src.as_str(), dst.as_str())
|
||||
} else {
|
||||
panic!("Uknown file type");
|
||||
}
|
||||
}
|
||||
Err(_) => win_fs::symlink_file(&src.value, &dst.value),
|
||||
Err(_) => win_fs::symlink_file(src.as_str(), dst.as_str()),
|
||||
};
|
||||
ret.map_err(|err| convert_io_error(vm, err))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user