[F] 💢💢💢💢💢💢💢💢💢💢💢
This commit is contained in:
parent
b58425badd
commit
cf6b77a1b7
3 changed files with 5 additions and 11 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -251,7 +251,7 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyfetch"
|
name = "hyfetch"
|
||||||
version = "2.0.0-rc4"
|
version = "2.0.0-rc5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"ansi_colours",
|
"ansi_colours",
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ resolver = "2"
|
||||||
members = ["crates/*"]
|
members = ["crates/*"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "2.0.0-rc4"
|
version = "2.0.0-rc5"
|
||||||
authors = ["Azalea Gui <azalea@hydev.org>"]
|
authors = ["Azalea Gui <azalea@hydev.org>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.75.0"
|
rust-version = "1.75.0"
|
||||||
|
|
|
||||||
|
|
@ -25,24 +25,18 @@ impl AsciiDistro {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn anything_that_exist(paths: &[&Path]) -> Option<PathBuf> {
|
|
||||||
paths.iter().copied().find(|p| p.exists()).map(Path::to_path_buf)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Path hack to make file paths work in both workspace and manifest directory
|
// Path hack to make file paths work in both workspace and manifest directory
|
||||||
let p_ws = PathBuf::from(env::var_os("CARGO_WORKSPACE_DIR").unwrap());
|
let dir = PathBuf::from(env::var_os("CARGO_WORKSPACE_DIR").unwrap_or_else(|| env::var_os("CARGO_MANIFEST_DIR").unwrap()));
|
||||||
let p_mn = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
|
|
||||||
let o = PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
let o = PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
||||||
|
|
||||||
for file in &["neofetch", "hyfetch"] {
|
for file in &["neofetch", "hyfetch"] {
|
||||||
let src = anything_that_exist(&[&p_ws.join(file), &p_mn.join(file)])
|
let src = dir.join(file);
|
||||||
.expect(&format!("{} not found in workspace or manifest directory", file));
|
|
||||||
let dst = o.join(file);
|
let dst = o.join(file);
|
||||||
println!("cargo:rerun-if-changed={}", src.display());
|
println!("cargo:rerun-if-changed={}", src.display());
|
||||||
|
|
||||||
// Copy either file or directory
|
// Copy either file or directory
|
||||||
if src.is_dir() {
|
if src.is_dir() {
|
||||||
let opt = CopyOptions { overwrite: true, copy_inside: true, ..CopyOptions::default() };
|
let opt = CopyOptions { overwrite: true, copy_inside: true, ..CopyOptions::default() };
|
||||||
fs_extra::dir::copy(&src, &dst, &opt).expect("Failed to copy directory to OUT_DIR");
|
fs_extra::dir::copy(&src, &dst, &opt).expect("Failed to copy directory to OUT_DIR");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue