Try to unmount hovered local dir

This commit is contained in:
Arun Prakash Jana 2021-06-28 00:16:32 +05:30
parent 96fb61a6a2
commit 1729a10ef4
No known key found for this signature in database
GPG key ID: A75979F35C080412

View file

@ -4518,7 +4518,7 @@ static bool unmount(char *name, char *newpath, int *presel, char *currentpath)
struct stat sb, psb; struct stat sb, psb;
bool child = FALSE; bool child = FALSE;
bool parent = FALSE; bool parent = FALSE;
bool hovered = TRUE; bool hovered = FALSE;
char mntpath[PATH_MAX]; char mntpath[PATH_MAX];
#if !defined(__APPLE__) && !defined(__FreeBSD__) #if !defined(__APPLE__) && !defined(__FreeBSD__)
@ -4545,11 +4545,15 @@ static bool unmount(char *name, char *newpath, int *presel, char *currentpath)
tmp = xreadline(NULL, messages[MSG_HOSTNAME]); tmp = xreadline(NULL, messages[MSG_HOSTNAME]);
if (!tmp[0]) if (!tmp[0])
return FALSE; return FALSE;
hovered = FALSE; if (name && (tmp[0] == '-') && (tmp[1] == '\0')) {
mkpath(currentpath, name, newpath);
hovered = TRUE;
}
} }
/* Create the mount point */ if (!hovered)
mkpath(mntpath, tmp, newpath); mkpath(mntpath, tmp, newpath);
if (!xdiraccess(newpath)) { if (!xdiraccess(newpath)) {
*presel = MSGWAIT; *presel = MSGWAIT;
return FALSE; return FALSE;
@ -4558,7 +4562,7 @@ static bool unmount(char *name, char *newpath, int *presel, char *currentpath)
#if defined(__APPLE__) || defined(__FreeBSD__) #if defined(__APPLE__) || defined(__FreeBSD__)
if (spawn(cmd, newpath, NULL, NULL, F_NORMAL)) { if (spawn(cmd, newpath, NULL, NULL, F_NORMAL)) {
#else #else
if (spawn(cmd, "-u", newpath, NULL, F_NORMAL)) { if (spawn(cmd, "-qu", newpath, NULL, F_NORMAL)) {
#endif #endif
if (!xconfirm(get_input(messages[MSG_LAZY]))) if (!xconfirm(get_input(messages[MSG_LAZY])))
return FALSE; return FALSE;
@ -4568,7 +4572,7 @@ static bool unmount(char *name, char *newpath, int *presel, char *currentpath)
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
if (spawn(cmd, "-f", newpath, NULL, F_NORMAL)) { if (spawn(cmd, "-f", newpath, NULL, F_NORMAL)) {
#else #else
if (spawn(cmd, "-uz", newpath, NULL, F_NORMAL)) { if (spawn(cmd, "-quz", newpath, NULL, F_NORMAL)) {
#endif #endif
printwait(messages[MSG_FAILED], presel); printwait(messages[MSG_FAILED], presel);
return FALSE; return FALSE;
@ -4580,7 +4584,7 @@ static bool unmount(char *name, char *newpath, int *presel, char *currentpath)
return FALSE; return FALSE;
} }
return hovered; return TRUE;
} }
static void lock_terminal(void) static void lock_terminal(void)