[F] Fix ascii from file for neofetch (#505)
Some checks failed
Shellcheck / check (push) Has been cancelled

This commit is contained in:
Azalea 2026-05-22 08:33:42 +08:00 committed by GitHub
parent e64f7efca6
commit 1890bb8f03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -65,6 +65,7 @@ fn main() -> Result<()> {
&dir.join("neofetch"),
&dir.join("../../neofetch"),
]).context("couldn't find neofetch")?;
println!("cargo:rerun-if-changed={}", neofetch_src.display());
fs::copy(&neofetch_src, o.join("neofetch"))?;
preset_codegen(&o.join("hyfetch/data/presets.json"), &o.join("presets.rs"))?;

View File

@ -5556,8 +5556,11 @@ strip_escape_codes() {
}
print_ascii() {
local ascii_from_file="off"
if [[ -f "$image_source" && ! "$image_source" =~ (png|jpg|jpeg|jpe|svg|gif) ]]; then
ascii_data="$(< "$image_source")"
ascii_from_file="on"
elif [[ "$image_source" == "ascii" || $image_source == auto ]]; then
:
else
@ -5586,7 +5589,7 @@ print_ascii() {
fi
# Fallback if file not found.
((lines==1)) && {
[[ "$ascii_from_file" != "on" ]] && ((lines==1)) && {
lines=
ascii_len=
image_source=auto