CreateJunction

This commit is contained in:
Jeong, YunWon
2024-04-17 03:39:14 +09:00
committed by Jeong, YunWon
parent 6c4ee951e0
commit 79e7015a32
5 changed files with 16 additions and 1 deletions

1
Cargo.lock generated
View File

@@ -2242,6 +2242,7 @@ dependencies = [
"gethostname",
"hex",
"itertools 0.11.0",
"junction",
"libc",
"libsqlite3-sys",
"libz-sys",

View File

@@ -56,6 +56,7 @@ indexmap = { version = "2.2.6", features = ["std"] }
insta = "1.38.0"
itertools = "0.11.0"
is-macro = "0.3.0"
junction = "1.0.0"
libc = "0.2.153"
log = "0.4.16"
nix = { version = "0.27", features = ["fs", "user", "process", "term", "time", "signal", "ioctl", "socket", "sched", "zerocopy", "dir", "hostname", "net", "poll"] }

View File

@@ -105,6 +105,7 @@ foreign-types-shared = { version = "0.1.1", optional = true }
libsqlite3-sys = { version = "0.25", features = ["min_sqlite_version_3_7_16", "bundled"] }
[target.'cfg(windows)'.dependencies]
junction = { workspace = true }
paste = { workspace = true }
schannel = { workspace = true }
widestring = { workspace = true }

View File

@@ -107,7 +107,7 @@ widestring = { workspace = true }
winreg = "0.10.1"
[target.'cfg(windows)'.dependencies.junction]
version = "1.0.0"
workspace = true
[target.'cfg(windows)'.dependencies.windows]
version = "0.52.0"

View File

@@ -257,6 +257,18 @@ mod _winapi {
return_value != 0
}
#[pyfunction]
fn CreateJunction(
src_path: PyStrRef,
dest_path: PyStrRef,
vm: &VirtualMachine,
) -> PyResult<()> {
let src_path = std::path::Path::new(src_path.as_str());
let dest_path = std::path::Path::new(dest_path.as_str());
junction::create(dest_path, src_path).map_err(|e| e.to_pyexception(vm))
}
fn getenvironment(env: ArgMapping, vm: &VirtualMachine) -> PyResult<Vec<u16>> {
let keys = env.mapping().keys(vm)?;
let values = env.mapping().values(vm)?;