瀏覽代碼

Add an api to check if copying possible

master
Arun Prakash Jana 6 年之前
父節點
當前提交
2324e8e3e7
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: A75979F35C080412
共有 1 個檔案被更改,包括 24 行新增16 行删除
  1. +24
    -16
      src/nnn.c

+ 24
- 16
src/nnn.c 查看文件

@@ -855,6 +855,29 @@ static bool showcplist()
return TRUE;
}

static bool cpsafe()
{
/* Fail if copy file path not generated */
if (!g_cppath[0]) {
printmsg("copy file not found");
return FALSE;
}

/* Warn if selection not completed */
if (cfg.copymode) {
printmsg("finish selection first");
return FALSE;
}

/* Fail if copy file path isn't accessible */
if (access(g_cppath, R_OK) == -1) {
printmsg("empty selection list");
return FALSE;
}

return TRUE;
}

/* Initialize curses mode */
static bool initcurses(void)
{
@@ -3423,23 +3446,8 @@ nochange:
case SEL_MV:
case SEL_RMMUL:
{
/* Fail if copy file path not generated */
if (!g_cppath[0]) {
printmsg("copy file not found");
goto nochange;
}

/* Warn if selection not completed */
if (cfg.copymode) {
printmsg("finish selection first");
if (!cpsafe())
goto nochange;
}

/* Fail if copy file path isn't accessible */
if (access(g_cppath, R_OK) == -1) {
printmsg("empty selection list");
goto nochange;
}

if (sel == SEL_CP) {
snprintf(g_buf, CMD_LEN_MAX,


||||||
x
 
000:0
Loading…
取消
儲存