commit 16de133fea30f2c51aa5dfb91f029ad726bdb587
parent 600286b62724829e10fce1df1b014f392e44f4aa
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date: Thu, 11 Feb 2021 05:26:51 +0530
Retain a way to return to start dir if file opened
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/nnn.c b/src/nnn.c
@@ -5904,6 +5904,11 @@ static bool browse(char *ipath, const char *session, int pkey)
lastname = g_ctx[0].c_name; /* last visited filename */
xstrsncpy(g_ctx[0].c_path, ipath, PATH_MAX);
+ /* If the initial path is a file, retain a way to return to start dir */
+ if (g_state.initfile) {
+ free(initpath);
+ initpath = ipath = getcwd(NULL, 0);
+ }
path = g_ctx[0].c_path; /* current directory */
g_ctx[0].c_fltr[0] = g_ctx[0].c_fltr[1] = '\0';