mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +03:00
Allow define keymap file without .keymap extension
...in the command line, environment variable and configuration file. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
260bd9742d
commit
6b41afecbf
21
src/setup.c
21
src/setup.c
@ -382,18 +382,25 @@ load_setup_get_full_config_name (const char *subdir, const char *config_file_nam
|
||||
TODO: IMHO, in future, this function shall be placed in mcconfig module.
|
||||
*/
|
||||
char *lc_basename, *ret;
|
||||
char *file_name;
|
||||
|
||||
if (config_file_name == NULL)
|
||||
return NULL;
|
||||
|
||||
if (g_path_is_absolute (config_file_name))
|
||||
{
|
||||
ret = g_strdup (config_file_name);
|
||||
canonicalize_pathname (ret);
|
||||
return ret;
|
||||
}
|
||||
/* check for .keymap suffix */
|
||||
if (g_str_has_suffix (config_file_name, ".keymap"))
|
||||
file_name = g_strdup (config_file_name);
|
||||
else
|
||||
file_name = g_strconcat (config_file_name, ".keymap", (char *) NULL);
|
||||
|
||||
canonicalize_pathname (file_name);
|
||||
|
||||
if (g_path_is_absolute (file_name))
|
||||
return file_name;
|
||||
|
||||
lc_basename = g_path_get_basename (file_name);
|
||||
g_free (file_name);
|
||||
|
||||
lc_basename = g_path_get_basename (config_file_name);
|
||||
if (lc_basename == NULL)
|
||||
return NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user