mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 13:51:31 +00:00
Minor refactor
This commit is contained in:
parent
05ae384b2d
commit
6d77b04032
13
src/nnn.c
13
src/nnn.c
|
@ -6395,20 +6395,15 @@ static bool setup_config(void)
|
||||||
|
|
||||||
static bool set_tmp_path(void)
|
static bool set_tmp_path(void)
|
||||||
{
|
{
|
||||||
char *path;
|
char *tmp = "/tmp";
|
||||||
|
char *path = xdiraccess(tmp) ? tmp : getenv("TMPDIR");
|
||||||
|
|
||||||
if (xdiraccess("/tmp"))
|
if (!path) {
|
||||||
g_tmpfplen = (uchar)xstrlcpy(g_tmpfpath, "/tmp", TMP_LEN_MAX);
|
|
||||||
else {
|
|
||||||
path = getenv("TMPDIR");
|
|
||||||
if (path)
|
|
||||||
g_tmpfplen = (uchar)xstrlcpy(g_tmpfpath, path, TMP_LEN_MAX);
|
|
||||||
else {
|
|
||||||
fprintf(stderr, "set TMPDIR\n");
|
fprintf(stderr, "set TMPDIR\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
g_tmpfplen = (uchar)xstrlcpy(g_tmpfpath, path, TMP_LEN_MAX);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue