Skip to content

Commit 658598f

Browse files
committed
--logo-source / --load-config: support path with env variables (*nix)
1 parent 290e721 commit 658598f

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Features:
3838
* Support yakuake terminal version & font detection (Terminal, Linux)
3939
* Add new option `--bright-color` which can be used to disable the default bright color of keys, title and ASCII logo.
4040
* Add module `Monitor` which prints physical parameters (native resolutions and demensions) of connected monitors
41+
* Support path with environment variables for `--logo-source` and `--load-config`.
4142

4243
Bugfixes:
4344
* Fix possible hanging (TerminalFont, #493)

src/common/io/io_unix.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <termios.h>
77
#include <poll.h>
88
#include <dirent.h>
9+
#include <wordexp.h>
910

1011
static void createSubfolders(const char* fileName)
1112
{
@@ -109,7 +110,20 @@ bool ffPathExists(const char* path, FFPathType type)
109110

110111
bool ffPathExpandEnv(const char* in, FFstrbuf* out)
111112
{
112-
return false;
113+
bool result = false;
114+
wordexp_t exp;
115+
if(wordexp(in, &exp, WRDE_NOCMD) != 0)
116+
return false;
117+
118+
if (exp.we_wordc == 1)
119+
{
120+
result = true;
121+
ffStrbufSetS(out, exp.we_wordv[0]);
122+
}
123+
124+
wordfree(&exp);
125+
126+
return result;
113127
}
114128

115129
const char* ffGetTerminalResponse(const char* request, const char* format, ...)

src/logo/logo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ static bool logoPrintFileIfExists(bool doColorReplacement, bool raw)
361361

362362
if(!ffAppendFileBuffer(options->source.chars, &content))
363363
{
364-
fputs("Logo: Failed to load file content from logo source\n", stderr);
364+
fprintf(stderr, "Logo: Failed to load file content from logo source: %s \n", options->source.chars);
365365
return false;
366366
}
367367

0 commit comments

Comments
 (0)