Skip to content

Commit 79e7015

Browse files
committed
CreateJunction
1 parent 6c4ee95 commit 79e7015

5 files changed

Lines changed: 16 additions & 1 deletion

File tree

‎Cargo.lock‎

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

‎Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ indexmap = { version = "2.2.6", features = ["std"] }
5656
insta = "1.38.0"
5757
itertools = "0.11.0"
5858
is-macro = "0.3.0"
59+
junction = "1.0.0"
5960
libc = "0.2.153"
6061
log = "0.4.16"
6162
nix = { version = "0.27", features = ["fs", "user", "process", "term", "time", "signal", "ioctl", "socket", "sched", "zerocopy", "dir", "hostname", "net", "poll"] }

‎stdlib/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ foreign-types-shared = { version = "0.1.1", optional = true }
105105
libsqlite3-sys = { version = "0.25", features = ["min_sqlite_version_3_7_16", "bundled"] }
106106

107107
[target.'cfg(windows)'.dependencies]
108+
junction = { workspace = true }
108109
paste = { workspace = true }
109110
schannel = { workspace = true }
110111
widestring = { workspace = true }

‎vm/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ widestring = { workspace = true }
107107
winreg = "0.10.1"
108108

109109
[target.'cfg(windows)'.dependencies.junction]
110-
version = "1.0.0"
110+
workspace = true
111111

112112
[target.'cfg(windows)'.dependencies.windows]
113113
version = "0.52.0"

‎vm/src/stdlib/winapi.rs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,18 @@ mod _winapi {
257257
return_value != 0
258258
}
259259

260+
#[pyfunction]
261+
fn CreateJunction(
262+
src_path: PyStrRef,
263+
dest_path: PyStrRef,
264+
vm: &VirtualMachine,
265+
) -> PyResult<()> {
266+
let src_path = std::path::Path::new(src_path.as_str());
267+
let dest_path = std::path::Path::new(dest_path.as_str());
268+
269+
junction::create(dest_path, src_path).map_err(|e| e.to_pyexception(vm))
270+
}
271+
260272
fn getenvironment(env: ArgMapping, vm: &VirtualMachine) -> PyResult<Vec<u16>> {
261273
let keys = env.mapping().keys(vm)?;
262274
let values = env.mapping().values(vm)?;

0 commit comments

Comments
 (0)