fix(link): Do not compile link support if not unix or windows

This commit is contained in:
Scott Haug 2023-02-27 09:58:04 -08:00
parent 3eaeabebfb
commit 6035f1c905
1 changed files with 3 additions and 7 deletions

View File

@ -9,6 +9,9 @@ use crate::async_lib::AsyncRead;
use crate::content::path; use crate::content::path;
use crate::errors::{IoErrorExt, Result}; use crate::errors::{IoErrorExt, Result};
#[cfg(not(any(unix, windows)))]
compile_error!("Symlinking is not supported on this platform.");
fn symlink_file<P, Q>(src: P, dst: Q) -> std::io::Result<()> fn symlink_file<P, Q>(src: P, dst: Q) -> std::io::Result<()>
where where
P: AsRef<Path>, P: AsRef<Path>,
@ -24,13 +27,6 @@ where
use std::os::windows::fs::symlink_file; use std::os::windows::fs::symlink_file;
symlink_file(src, dst) symlink_file(src, dst)
} }
#[cfg(not(any(unix, windows)))]
{
Err(std::io::Error::new(
std::io::ErrorKind::Other,
"symlinking is not supported on this platform",
))
}
} }
fn create_symlink(sri: Integrity, cache: &PathBuf, target: &PathBuf) -> Result<Integrity> { fn create_symlink(sri: Integrity, cache: &PathBuf, target: &PathBuf) -> Result<Integrity> {