#define MSG_COPY_NAME 23
#define MSG_CONTINUE 24
#define MSG_SEL_MISSING 25
-#define MSG_SSN_MISSING 26
-#define MSG_DIR_ACCESS 27
-#define MSG_0_CREATED 28
-#define MSG_NOT_REG_FILE 29
-#define MSG_PERM_DENIED 30
-#define MSG_EMPTY_FILE 31
-#define MSG_UNSUPPORTED 32
-#define MSG_NOT_SET 33
-#define MSG_RANGE_SEL_ON 34
-#define MSG_DIR_CHANGED 35
-#define MSG_0_FILES 36
-#define MSG_EXISTS 37
-#define MSG_FEW_COLOUMNS 38
-#define MSG_REMOTE_OPTS 39
-#define MSG_RCLONE_DELAY 40
-#define MSG_APP_NAME 41
-#define MSG_ARCHIVE_OPTS 42
+#define MSG_ACCESS 26
+#define MSG_0_CREATED 27
+#define MSG_NOT_REG_FILE 28
+#define MSG_PERM_DENIED 29
+#define MSG_EMPTY_FILE 30
+#define MSG_UNSUPPORTED 31
+#define MSG_NOT_SET 32
+#define MSG_RANGE_SEL_ON 33
+#define MSG_DIR_CHANGED 34
+#define MSG_0_FILES 35
+#define MSG_EXISTS 36
+#define MSG_FEW_COLOUMNS 37
+#define MSG_REMOTE_OPTS 38
+#define MSG_RCLONE_DELAY 39
+#define MSG_APP_NAME 40
+#define MSG_ARCHIVE_OPTS 41
static const char * const messages[] = {
"no traversal",
"link suffix [@ for none]: ",
"copy name: ",
"\nPress Enter to continue",
- "sel file missing",
- "session file missing",
+ "open failed",
"dir inaccessible",
"0 created",
"not regular file",
fsession = fopen(spath, "wb");
if (!fsession) {
- printwait(messages[MSG_SSN_MISSING], presel);
+ printwait(messages[MSG_ACCESS], presel);
return;
}
fsession = fopen(spath, "rb");
if (!fsession) {
- printmsg(messages[MSG_SSN_MISSING]);
+ printmsg(messages[MSG_ACCESS]);
xdelay(XDELAY_INTERVAL_MS);
return FALSE;
}
xstrlcpy(path, dir, PATH_MAX);
- printmsg(messages[MSG_DIR_ACCESS]);
+ printmsg(messages[MSG_ACCESS]);
xdelay(XDELAY_INTERVAL_MS);
}
return TRUE;
}
+static void launch_app(const char *path, char *newpath)
+{
+ int r = F_NORMAL;
+ char *tmp = newpath;
+
+ mkpath(plugindir, utils[UTIL_LAUNCH], newpath);
+
+ if (!(getutil(utils[UTIL_FZF]) || getutil(utils[UTIL_FZY])) || access(newpath, X_OK) < 0) {
+ tmp = xreadline(NULL, messages[MSG_APP_NAME]);
+ r = F_NOWAIT | F_NOTRACE | F_MULTI;
+ }
+
+ if (tmp && *tmp) // NOLINT
+ spawn(tmp, "0", NULL, path, r);
+}
+
static int sum_bsizes(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf)
{
(void) fpath;
setdirwatch();
goto begin;
case SEL_LAUNCH:
- mkpath(plugindir, utils[UTIL_LAUNCH], newpath);
- if ((getutil(utils[UTIL_FZF]) || getutil(utils[UTIL_FZY]))
- && access(newpath, X_OK) == 0) {
- tmp = newpath;
- r = F_NORMAL;
- } else {
- tmp = xreadline(NULL, messages[MSG_APP_NAME]);
- r = F_NOWAIT | F_NOTRACE | F_MULTI;
- }
-
- if (tmp && *tmp) // NOLINT
- spawn(tmp, "0", NULL, path, r);
+ launch_app(path, newpath);
if (cfg.filtermode)
presel = FILTER;