mirror of
https://github.com/jarun/nnn.git
synced 2025-01-09 17:39:38 +00:00
Fix #261
This commit is contained in:
parent
3ca86eafbe
commit
95eaa636ef
21
src/nnn.c
21
src/nnn.c
|
@ -4360,6 +4360,10 @@ int main(int argc, char *argv[])
|
||||||
if (!setup_config())
|
if (!setup_config())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
/* Get custom opener, if set */
|
||||||
|
opener = xgetenv(env_cfg[NNN_OPENER], utils[OPENER]);
|
||||||
|
DPRINTF_S(opener);
|
||||||
|
|
||||||
/* Parse bookmarks string */
|
/* Parse bookmarks string */
|
||||||
if (!parsebmstr()) {
|
if (!parsebmstr()) {
|
||||||
fprintf(stderr, "%s\n", env_cfg[NNN_BMS]);
|
fprintf(stderr, "%s\n", env_cfg[NNN_BMS]);
|
||||||
|
@ -4387,6 +4391,23 @@ int main(int argc, char *argv[])
|
||||||
xerror();
|
xerror();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If nnn is set as the file manager, applications may try to open
|
||||||
|
* files by invoking nnn. In that case pass the file path to the
|
||||||
|
* desktop opener and exit.
|
||||||
|
*/
|
||||||
|
struct stat sb;
|
||||||
|
|
||||||
|
if (stat(initpath, &sb) == -1) {
|
||||||
|
xerror();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (S_ISREG(sb.st_mode)) {
|
||||||
|
execlp(opener, opener, arg, NULL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Edit text in EDITOR, if opted */
|
/* Edit text in EDITOR, if opted */
|
||||||
|
|
Loading…
Reference in a new issue