Switch to current dir to run editor/vidir

This commit is contained in:
Arun Prakash Jana 2018-03-19 05:59:15 +05:30
parent 95a3e0fca4
commit 0e623010e6
No known key found for this signature in database
GPG key ID: A75979F35C080412

23
nnn.c
View file

@ -2520,7 +2520,7 @@ nochange:
*/ */
if (editor) { if (editor) {
if (getmime(dents[cur].name)) { if (getmime(dents[cur].name)) {
spawn(editor, newpath, NULL, NULL, F_NORMAL); spawn(editor, newpath, NULL, path, F_NORMAL);
continue; continue;
} }
@ -2531,7 +2531,7 @@ nochange:
continue; continue;
if (strstr(g_buf, "text/") == g_buf) { if (strstr(g_buf, "text/") == g_buf) {
spawn(editor, newpath, NULL, NULL, F_NORMAL); spawn(editor, newpath, NULL, path, F_NORMAL);
continue; continue;
} }
} }
@ -3150,24 +3150,7 @@ nochange:
goto nochange; goto nochange;
} }
/* Save the program start dir */ spawn(utils[VIDIR], ".", NULL, path, F_NORMAL);
tmp = getcwd(newpath, PATH_MAX);
if (tmp == NULL) {
printwarn();
goto nochange;
}
/* Switch to current path for readline(3) */
if (chdir(path) == -1) {
printwarn();
goto nochange;
}
spawn(utils[VIDIR], ".", NULL, NULL, F_NORMAL);
/* Change back to program start dir */
if (chdir(newpath) == -1)
printwarn();
/* Save current */ /* Save current */
if (ndents > 0) if (ndents > 0)