mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
db7f72e14a
commit
fa6e57d0ce
2 changed files with 6 additions and 15 deletions
|
|
@ -109,13 +109,11 @@ impl Executor {
|
|||
}
|
||||
}
|
||||
"link" => {
|
||||
let dest = cx.manager.cwd().to_owned();
|
||||
let (cut, src) = cx.manager.yanked();
|
||||
|
||||
!cut
|
||||
&& cx.tasks.file_link(
|
||||
src,
|
||||
dest,
|
||||
cx.manager.cwd().to_owned(),
|
||||
exec.named.contains_key("relative"),
|
||||
exec.named.contains_key("force"),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -131,18 +131,11 @@ mod tests {
|
|||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn test_path_relative_to() {
|
||||
let foo = "/foo";
|
||||
let bar = "/foo/bar";
|
||||
let baz = "/foo/bar/baz";
|
||||
let qux = "/foo/bar/qux";
|
||||
let aha = "/foo/aha/bar";
|
||||
|
||||
assert_path_relate_to_root(bar, baz, "../"); // self reflection
|
||||
assert_path_relate_to_root(baz, bar, "baz"); // child entry
|
||||
assert_path_relate_to_root(qux, baz, "../qux"); // sibling entry
|
||||
assert_path_relate_to_root(baz, qux, "../baz"); // sibling entry
|
||||
assert_path_relate_to_root(foo, baz, "../../"); // ancestor entry
|
||||
assert_path_relate_to_root(aha, baz, "../../aha/bar"); // ancestor's child entry
|
||||
assert_path_relate_to_root("/a/b", "/a/b/c", "../");
|
||||
assert_path_relate_to_root("/a/b/c", "/a/b", "c");
|
||||
assert_path_relate_to_root("/a/b/c", "/a/b/d", "../c");
|
||||
assert_path_relate_to_root("/a", "/a/b/c", "../../");
|
||||
assert_path_relate_to_root("/a/a/b", "/a/b/b", "../../b/b");
|
||||
}
|
||||
|
||||
fn assert_path_relate_to_root(path: &str, root: &str, res: &str) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue