1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use super::open_parent;
use crate::fs::MaybeOwnedFile;
use std::path::Path;
use std::{fs, io};
#[cfg(not(windows))]
pub(crate) fn symlink(old_path: &Path, new_start: &fs::File, new_path: &Path) -> io::Result<()> {
use crate::fs::symlink_unchecked;
let new_start = MaybeOwnedFile::borrowed(new_start);
let (new_dir, new_basename) = open_parent(new_start, new_path)?;
symlink_unchecked(old_path, &new_dir, new_basename.as_ref())
}
#[cfg(windows)]
pub(crate) fn symlink_file(
old_path: &Path,
new_start: &fs::File,
new_path: &Path,
) -> io::Result<()> {
use crate::fs::symlink_file_unchecked;
let new_start = MaybeOwnedFile::borrowed(new_start);
let (new_dir, new_basename) = open_parent(new_start, new_path)?;
symlink_file_unchecked(old_path, &new_dir, new_basename.as_ref())
}
#[cfg(windows)]
pub(crate) fn symlink_dir(
old_path: &Path,
new_start: &fs::File,
new_path: &Path,
) -> io::Result<()> {
use crate::fs::symlink_dir_unchecked;
let new_start = MaybeOwnedFile::borrowed(new_start);
let (new_dir, new_basename) = open_parent(new_start, new_path)?;
symlink_dir_unchecked(old_path, &new_dir, new_basename.as_ref())
}