--logo-source / --load-config: support path with env variables (*nix)

This commit is contained in:
李通洲
2023-08-13 10:59:50 +08:00
parent 290e721ee1
commit 658598f43a
3 changed files with 17 additions and 2 deletions
+1
View File
@@ -38,6 +38,7 @@ Features:
* Support yakuake terminal version & font detection (Terminal, Linux)
* Add new option `--bright-color` which can be used to disable the default bright color of keys, title and ASCII logo.
* Add module `Monitor` which prints physical parameters (native resolutions and demensions) of connected monitors
* Support path with environment variables for `--logo-source` and `--load-config`.
Bugfixes:
* Fix possible hanging (TerminalFont, #493)
+15 -1
View File
@@ -6,6 +6,7 @@
#include <termios.h>
#include <poll.h>
#include <dirent.h>
#include <wordexp.h>
static void createSubfolders(const char* fileName)
{
@@ -109,7 +110,20 @@ bool ffPathExists(const char* path, FFPathType type)
bool ffPathExpandEnv(const char* in, FFstrbuf* out)
{
return false;
bool result = false;
wordexp_t exp;
if(wordexp(in, &exp, WRDE_NOCMD) != 0)
return false;
if (exp.we_wordc == 1)
{
result = true;
ffStrbufSetS(out, exp.we_wordv[0]);
}
wordfree(&exp);
return result;
}
const char* ffGetTerminalResponse(const char* request, const char* format, ...)
+1 -1
View File
@@ -361,7 +361,7 @@ static bool logoPrintFileIfExists(bool doColorReplacement, bool raw)
if(!ffAppendFileBuffer(options->source.chars, &content))
{
fputs("Logo: Failed to load file content from logo source\n", stderr);
fprintf(stderr, "Logo: Failed to load file content from logo source: %s \n", options->source.chars);
return false;
}