diff --git a/src/logo/image/image.c b/src/logo/image/image.c index ebeb2c2fe..ea848a16d 100644 --- a/src/logo/image/image.c +++ b/src/logo/image/image.c @@ -54,13 +54,14 @@ static FFstrbuf base64Encode(const FFstrbuf* in) return out; } -static bool printImageIterm(void) +static bool printImageIterm(bool printError) { const FFOptionsLogo* options = &instance.config.logo; FF_STRBUF_AUTO_DESTROY buf = ffStrbufCreate(); if(!ffAppendFileBuffer(options->source.chars, &buf)) { - fputs("Logo: Failed to load image file\n", stderr); + if (printError) + fputs("Logo (iterm): Failed to load image file\n", stderr); return false; } @@ -135,9 +136,17 @@ static bool printImageIterm(void) return true; } -static bool printImageKittyDirect(void) +static bool printImageKittyDirect(bool printError) { const FFOptionsLogo* options = &instance.config.logo; + + if (!ffPathExists(options->source.chars, FF_PATHTYPE_FILE)) + { + if (printError) + fputs("Logo (kitty-direct): Failed to load image file\n", stderr); + return false; + } + FF_STRBUF_AUTO_DESTROY base64 = base64Encode(&options->source); if (!options->width || !options->height) @@ -857,10 +866,10 @@ bool ffLogoPrintImageIfExists(FFLogoType type, bool printError) if(type == FF_LOGO_TYPE_IMAGE_ITERM) - return printImageIterm(); + return printImageIterm(printError); if(type == FF_LOGO_TYPE_IMAGE_KITTY_DIRECT) - return printImageKittyDirect(); + return printImageKittyDirect(printError); #if !defined(FF_HAVE_CHAFA) if(type == FF_LOGO_TYPE_IMAGE_CHAFA) diff --git a/src/logo/logo.c b/src/logo/logo.c index 708bc6c7f..d9af22a90 100644 --- a/src/logo/logo.c +++ b/src/logo/logo.c @@ -393,7 +393,8 @@ static bool logoPrintFileIfExists(bool doColorReplacement, bool raw) : !ffAppendFileBuffer(options->source.chars, &content) ) { - fprintf(stderr, "Logo: Failed to load file content from logo source: %s \n", options->source.chars); + if (instance.config.display.showErrors) + fprintf(stderr, "Logo: Failed to load file content from logo source: %s \n", options->source.chars); return false; } @@ -448,7 +449,7 @@ static bool logoTryKnownType(void) if(options->type == FF_LOGO_TYPE_IMAGE_RAW) return logoPrintFileIfExists(false, true); - return logoPrintImageIfExists(options->type, true); + return logoPrintImageIfExists(options->type, instance.config.display.showErrors); } static void logoPrintKnownType(void)