Ticket #4141: allow compound (AND) conditions in mc.ext

...to disambiguate overloaded extensions

Initial commit:
  * rename macro for mc.ext file: MC_FILEBIND_FILE -> MC_EXT_FILE.
  * (ext_cmd): fix errorous usage of MC_LIB_EXT macro. Use MC_EXT_FILE
    instead.
  * (regex_command_for): likewise. Use already existing variable
    extension_file, remove variable filebind_filename.
  * MC_LIB_EXT: remove macro.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2022-07-22 20:12:59 +03:00
parent 1294c7bad1
commit 67ec86b570
5 changed files with 23 additions and 24 deletions

View File

@ -28,7 +28,6 @@
#define MC_HELP "help" PATH_SEP_STR "mc.hlp"
#define GLOBAL_KEYMAP_FILE "mc.keymap"
#define CHARSETS_LIST "mc.charsets"
#define MC_LIB_EXT "mc.ext"
#define MC_MACRO_FILE "mc.macros"
#define FISH_PREFIX "fish"
@ -56,7 +55,7 @@
#define MC_ASHRC_FILE "ashrc"
#define MC_INPUTRC_FILE "inputrc"
#define MC_CONFIG_FILE "ini"
#define MC_FILEBIND_FILE "mc.ext"
#define MC_EXT_FILE "mc.ext"
#define MC_FILEPOS_FILE "filepos"
#define MC_HISTORY_FILE "history"
#define MC_HOTLIST_FILE "hotlist"

View File

@ -69,7 +69,7 @@ static const struct
{ &mc_config_str, MC_PANELS_FILE },
/* User should move this file with applying some changes in file */
{ &mc_config_str, MC_FILEBIND_FILE },
{ &mc_config_str, MC_EXT_FILE },
/* data */
{ &mc_data_str, MC_SKINS_DIR },

View File

@ -812,13 +812,13 @@ ext_cmd (void)
_("Which extension file you want to edit?"), D_NORMAL, 2,
_("&User"), _("&System Wide"));
extdir_vpath = vfs_path_build_filename (mc_global.sysconfig_dir, MC_LIB_EXT, (char *) NULL);
extdir_vpath = vfs_path_build_filename (mc_global.sysconfig_dir, MC_EXT_FILE, (char *) NULL);
if (dir == 0)
{
vfs_path_t *buffer_vpath;
buffer_vpath = mc_config_get_full_vpath (MC_FILEBIND_FILE);
buffer_vpath = mc_config_get_full_vpath (MC_EXT_FILE);
check_for_default (extdir_vpath, buffer_vpath);
do_edit (buffer_vpath);
vfs_path_free (buffer_vpath, TRUE);
@ -829,7 +829,7 @@ ext_cmd (void)
{
vfs_path_free (extdir_vpath, TRUE);
extdir_vpath =
vfs_path_build_filename (mc_global.share_data_dir, MC_LIB_EXT, (char *) NULL);
vfs_path_build_filename (mc_global.share_data_dir, MC_EXT_FILE, (char *) NULL);
}
do_edit (extdir_vpath);
}

View File

@ -821,17 +821,18 @@ regex_command_for (void *target, const vfs_path_t * filename_vpath, const char *
gboolean mc_user_ext = TRUE;
gboolean home_error = FALSE;
extension_file = mc_config_get_full_path (MC_FILEBIND_FILE);
extension_file = mc_config_get_full_path (MC_EXT_FILE);
if (!exist_file (extension_file))
{
g_free (extension_file);
check_stock_mc_ext:
extension_file = mc_build_filename (mc_global.sysconfig_dir, MC_LIB_EXT, (char *) NULL);
extension_file =
mc_build_filename (mc_global.sysconfig_dir, MC_EXT_FILE, (char *) NULL);
if (!exist_file (extension_file))
{
g_free (extension_file);
extension_file =
mc_build_filename (mc_global.share_data_dir, MC_LIB_EXT, (char *) NULL);
mc_build_filename (mc_global.share_data_dir, MC_EXT_FILE, (char *) NULL);
}
mc_user_ext = FALSE;
}
@ -853,12 +854,12 @@ regex_command_for (void *target, const vfs_path_t * filename_vpath, const char *
char *title;
title = g_strdup_printf (_(" %s%s file error"),
mc_global.sysconfig_dir, MC_LIB_EXT);
message (D_ERROR, title, _("The format of the %smc.ext "
"file has changed with version 3.0. It seems that "
"the installation failed. Please fetch a fresh "
"copy from the Midnight Commander package."),
mc_global.sysconfig_dir);
mc_global.sysconfig_dir, MC_EXT_FILE);
message (D_ERROR, title, _("The format of the %s%s file has changed with "
"version 3.0. It seems that the installation failed. "
"Please fetch a fresh copy from the "
"Midnight Commander package."),
mc_global.sysconfig_dir, MC_EXT_FILE);
g_free (title);
return 0;
}
@ -870,17 +871,16 @@ regex_command_for (void *target, const vfs_path_t * filename_vpath, const char *
if (home_error)
{
char *filebind_filename;
char *title;
filebind_filename = mc_config_get_full_path (MC_FILEBIND_FILE);
title = g_strdup_printf (_("%s file error"), filebind_filename);
extension_file = mc_config_get_full_path (MC_EXT_FILE);
title = g_strdup_printf (_("%s file error"), extension_file);
message (D_ERROR, title,
_("The format of the %s file has "
"changed with version 3.0. You may either want to copy "
"it from %smc.ext or use that file as an example of how to write it."),
filebind_filename, mc_global.sysconfig_dir);
g_free (filebind_filename);
_("The format of the %s file has changed with version 3.0. "
"You may either want to copy it from %s%s or use that file "
"as an example of how to write it."),
extension_file, mc_global.sysconfig_dir, MC_EXT_FILE);
g_free (extension_file);
g_free (title);
}
}

View File

@ -110,7 +110,7 @@ static const struct test_user_config_paths_ds
},
{ /* 8. */
CONF_MAIN,
MC_FILEBIND_FILE
MC_EXT_FILE
},
{ /* 9. */
CONF_DATA,