}
#endif
-static void convert_tilde(const char *path, char *buf)
+static bool convert_tilde(const char *path, char *buf)
{
if (tilde_is_home(path)) {
ssize_t len = xstrlen(home);
xstrsncpy(buf, home, len + 1);
xstrsncpy(buf + len, path + 1, loclen);
+ return true;
}
+ return false;
}
static int create_tmp_file(void)
static void write_lastdir(const char *curpath, const char *outfile)
{
+ bool tilde = false;
if (!outfile)
xstrsncpy(cfgpath + xstrlen(cfgpath), "/.lastd", 8);
else
- convert_tilde(outfile, g_buf);
+ tilde = convert_tilde(outfile, g_buf);
int fd = open(outfile
- ? (tilde_is_home(outfile) ? g_buf : outfile)
+ ? (tilde ? g_buf : outfile)
: cfgpath, O_CREAT | O_WRONLY | O_TRUNC, S_IWUSR | S_IRUSR);
if (fd != -1) {
return pluginstr + kvarr[r].off;
val = bmstr + kvarr[r].off;
- convert_tilde(val, g_buf);
- return abspath((tilde_is_home(val) ? g_buf : val), NULL, buf);
+ bool tilde = convert_tilde(val, g_buf);
+ return abspath((tilde ? g_buf : val), NULL, buf);
}
}