mirror of
https://github.com/jarun/nnn.git
synced 2025-02-26 03:01:32 +00:00
Ensure NNN_SCRIPT(suffix) exists
This commit is contained in:
parent
5d1ca249f9
commit
7119310a6a
2 changed files with 10 additions and 4 deletions
10
src/nnn.c
10
src/nnn.c
|
@ -3372,8 +3372,8 @@ nochange:
|
||||||
xstrlcpy(lastname, tmp, NAME_MAX + 1);
|
xstrlcpy(lastname, tmp, NAME_MAX + 1);
|
||||||
goto begin;
|
goto begin;
|
||||||
case SEL_SHELL: // fallthrough
|
case SEL_SHELL: // fallthrough
|
||||||
case SEL_RUNSCRIPT:
|
case SEL_SCRIPT:
|
||||||
if (sel == SEL_RUNSCRIPT) {
|
if (sel == SEL_SCRIPT) {
|
||||||
tmp = getenv("NNN_SCRIPT");
|
tmp = getenv("NNN_SCRIPT");
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
if (getenv("NNN_MULTISCRIPT")) {
|
if (getenv("NNN_MULTISCRIPT")) {
|
||||||
|
@ -3385,6 +3385,12 @@ nochange:
|
||||||
tmp = newpath;
|
tmp = newpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if file exists */
|
||||||
|
if (access(tmp, F_OK) == -1) {
|
||||||
|
printwarn();
|
||||||
|
goto nochange;
|
||||||
|
}
|
||||||
|
|
||||||
dir = NULL; /* dir used as temp var */
|
dir = NULL; /* dir used as temp var */
|
||||||
if (ndents)
|
if (ndents)
|
||||||
dir = dents[cur].name;
|
dir = dents[cur].name;
|
||||||
|
|
|
@ -81,7 +81,7 @@ enum action {
|
||||||
SEL_RENAMEALL,
|
SEL_RENAMEALL,
|
||||||
SEL_HELP,
|
SEL_HELP,
|
||||||
SEL_SHELL,
|
SEL_SHELL,
|
||||||
SEL_RUNSCRIPT,
|
SEL_SCRIPT,
|
||||||
SEL_RUNEDIT,
|
SEL_RUNEDIT,
|
||||||
SEL_RUNPAGE,
|
SEL_RUNPAGE,
|
||||||
SEL_LOCK,
|
SEL_LOCK,
|
||||||
|
@ -213,7 +213,7 @@ static struct key bindings[] = {
|
||||||
{ '!', SEL_SHELL },
|
{ '!', SEL_SHELL },
|
||||||
{ CONTROL(']'), SEL_SHELL },
|
{ CONTROL(']'), SEL_SHELL },
|
||||||
/* Run a custom script */
|
/* Run a custom script */
|
||||||
{ 'R', SEL_RUNSCRIPT },
|
{ 'R', SEL_SCRIPT },
|
||||||
/* Run command with argument */
|
/* Run command with argument */
|
||||||
{ 'e', SEL_RUNEDIT },
|
{ 'e', SEL_RUNEDIT },
|
||||||
{ 'p', SEL_RUNPAGE },
|
{ 'p', SEL_RUNPAGE },
|
||||||
|
|
Loading…
Add table
Reference in a new issue