8000 Implement windows platform target `is_junction` with junction library · RustPython/RustPython@4d11adf · GitHub
[go: up one dir, main page]

Skip to content

Commit 4d11adf

Browse files
committed
Implement windows platform target is_junction with junction library
1 parent 1cd4e45 commit 4d11adf

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

Cargo.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vm/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ schannel = { workspace = true }
106106
widestring = { workspace = true }
107107
winreg = "0.10.1"
108108

109+
[target.'cfg(windows)'.dependencies.junction]
110+
version = "1.0.0"
111+
109112
[target.'cfg(windows)'.dependencies.windows]
110113
version = "0.52.0"
111114
features = [

vm/src/stdlib/os.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -743,13 +743,10 @@ pub(super) mod _os {
743743
Ok(false)
744744
}
745745

746-
// TODO: RUSTPYTHON
747-
// Check is_junction method logic is correct.
748746
#[cfg(windows)]
749747
#[pymethod]
750748
fn is_junction(&self, _vm: &VirtualMachine) -> PyResult<bool> {
751-
fs::metadata(&path).map_or(false, |meta| meta.file_type().is_dir())
752-
&& fs::symlink_metadata(&path).map_or(false, |meta| meta.file_type().is_symlink())
749+
Ok(junction::exists(self.pathval.clone()).unwrap_or(false))
753750
}
754751

755752
#[pymethod(magic)]

0 commit comments

Comments
 (0)
0