static char *prefixpath;
static char *plugindir;
static char *sessiondir;
+static char *mountdir;
static char *pnamebuf, *pselbuf;
static char *mark;
#ifndef NOFIFO
DPRINTF_S(dir);
/* Create the mount point */
- mkpath(cfgdir, dir, newpath);
+ mkpath(mountdir, dir, newpath);
free(dir);
if (!xmktree(newpath, TRUE)) {
}
/* Create the mount point */
- mkpath(cfgdir, tmp, newpath);
+ mkpath(mountdir, tmp, newpath);
if (!xmktree(newpath, TRUE)) {
printwarn(NULL);
return FALSE;
}
#endif
- if (tmp && strcmp(cfgdir, currentpath) == 0) {
- mkpath(cfgdir, tmp, newpath);
+ if (tmp && strcmp(mountdir, currentpath) == 0) {
+ mkpath(mountdir, tmp, newpath);
child = lstat(newpath, &sb) != -1;
parent = lstat(xdirname(newpath), &psb) != -1;
if (!child && !parent) {
}
/* Create the mount point */
- mkpath(cfgdir, tmp, newpath);
+ mkpath(mountdir, tmp, newpath);
if (!xdiraccess(newpath)) {
*presel = MSGWAIT;
return FALSE;
cfgdir = (char *)malloc(len);
plugindir = (char *)malloc(len);
sessiondir = (char *)malloc(len);
+ mountdir = (char *)malloc(len);
if (!cfgdir || !plugindir || !sessiondir) {
xerror();
return FALSE;
DPRINTF_S(cfgdir);
/* Create ~/.config/nnn/plugins */
- xstrsncpy(plugindir, cfgdir, PATH_MAX);
- xstrsncpy(plugindir + r + 4 - 1, "/plugins", 9); /* subtract length of "/nnn" (4) */
- DPRINTF_S(plugindir);
-
- if (access(plugindir, F_OK) && !xmktree(plugindir, TRUE)) {
+ mkpath(cfgdir, "plugins", plugindir);
+ if (!xmktree(plugindir, TRUE)) {
xerror();
return FALSE;
}
/* Create ~/.config/nnn/sessions */
- xstrsncpy(sessiondir, cfgdir, PATH_MAX);
- xstrsncpy(sessiondir + r + 4 - 1, "/sessions", 10); /* subtract length of "/nnn" (4) */
- DPRINTF_S(sessiondir);
+ mkpath(cfgdir, "sessions", sessiondir);
+ if (!xmktree(sessiondir, TRUE)) {
+ xerror();
+ return FALSE;
+ }
- if (access(sessiondir, F_OK) && !xmktree(sessiondir, TRUE)) {
+ /* Create ~/.config/nnn/mounts */
+ mkpath(cfgdir, "mounts", mountdir);
+ if (!xmktree(mountdir, TRUE)) {
xerror();
return FALSE;
}
free(selpath);
free(plugindir);
free(sessiondir);
+ free(mountdir);
free(cfgdir);
free(initpath);
free(bmstr);