mirror of https://github.com/MidnightCommander/mc
Added function mc_config_get_full_path() for search user's config files by short names.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
25c9267ac3
commit
6c32fa3b84
|
@ -199,7 +199,7 @@ mc_fhl_init_from_standard_files (mc_fhl_t * fhl)
|
|||
gboolean ok;
|
||||
|
||||
/* ${XDG_CONFIG_HOME}/mc/filehighlight.ini */
|
||||
name = g_build_filename (mc_config_get_data_path (), MC_FHL_INI_FILE, (char *) NULL);
|
||||
name = mc_config_get_full_path (MC_FHL_INI_FILE);
|
||||
ok = mc_fhl_read_ini_file (fhl, name);
|
||||
g_free (name);
|
||||
if (ok)
|
||||
|
|
|
@ -104,7 +104,7 @@ get_log_filename (void)
|
|||
if (mc_config_has_param (mc_main_config, CONFIG_GROUP_NAME, CONFIG_KEY_NAME_FILE))
|
||||
return mc_config_get_string (mc_main_config, CONFIG_GROUP_NAME, CONFIG_KEY_NAME_FILE, NULL);
|
||||
|
||||
return g_build_filename (mc_config_get_cache_path (), "mc.log", NULL);
|
||||
return mc_config_get_full_path ("mc.log");
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
|
|
@ -108,6 +108,8 @@ const char *mc_config_get_path (void);
|
|||
|
||||
const char *mc_config_get_home_dir (void);
|
||||
|
||||
char *mc_config_get_full_path (const char *config_name);
|
||||
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ static const struct
|
|||
|
||||
char **new_basedir;
|
||||
const char *new_filename;
|
||||
} mc_config_migrate_rules[] =
|
||||
} mc_config_files_reference[] =
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
/* config */
|
||||
|
@ -74,8 +74,9 @@ static const struct
|
|||
{ "cedit" PATH_SEP_STR "edit.indent.rc", &mc_config_str, EDIT_DIR PATH_SEP_STR "edit.indent.rc"},
|
||||
{ "cedit" PATH_SEP_STR "edit.spell.rc", &mc_config_str, EDIT_DIR PATH_SEP_STR "edit.spell.rc"},
|
||||
{ "panels.ini", &mc_config_str, MC_PANELS_FILE},
|
||||
|
||||
/* User should move this file with applying some changes in file */
|
||||
/* { "bindings", &mc_config_str, MC_FILEBIND_FILE}, */
|
||||
{ "", &mc_config_str, MC_FILEBIND_FILE},
|
||||
|
||||
/* data */
|
||||
{ "skins", &mc_data_str, MC_SKINS_SUBDIR},
|
||||
|
@ -86,6 +87,7 @@ static const struct
|
|||
{ "history", &mc_data_str, MC_HISTORY_FILE},
|
||||
{ "filepos", &mc_data_str, MC_FILEPOS_FILE},
|
||||
{ "cedit" PATH_SEP_STR "cooledit.clip", &mc_data_str, EDIT_CLIP_FILE},
|
||||
{ "", &mc_data_str, MC_MACRO_FILE},
|
||||
|
||||
/* cache */
|
||||
{ "log", &mc_cache_str, "mc.log"},
|
||||
|
@ -239,7 +241,7 @@ mc_config_fix_migrated_rules (void)
|
|||
char *new_name;
|
||||
|
||||
new_name = g_build_filename (*mc_config_migrate_rules_fix[rule_index].new_basedir,
|
||||
mc_config_migrate_rules[rule_index].new_filename, NULL);
|
||||
mc_config_files_reference[rule_index].new_filename, NULL);
|
||||
|
||||
rename (old_name, new_name);
|
||||
|
||||
|
@ -394,19 +396,21 @@ mc_config_migrate_from_old_place (GError ** error)
|
|||
g_free (mc_config_init_one_config_path (mc_data_str, EDIT_DIR, error));
|
||||
#endif /* MC_HOMEDIR_XDG */
|
||||
|
||||
for (rule_index = 0; mc_config_migrate_rules[rule_index].old_filename != NULL; rule_index++)
|
||||
for (rule_index = 0; mc_config_files_reference[rule_index].old_filename != NULL; rule_index++)
|
||||
{
|
||||
char *old_name;
|
||||
if (*mc_config_files_reference[rule_index].old_filename == '\0')
|
||||
continue;
|
||||
|
||||
old_name =
|
||||
g_build_filename (old_dir, mc_config_migrate_rules[rule_index].old_filename, NULL);
|
||||
g_build_filename (old_dir, mc_config_files_reference[rule_index].old_filename, NULL);
|
||||
|
||||
if (g_file_test (old_name, G_FILE_TEST_EXISTS))
|
||||
{
|
||||
char *new_name;
|
||||
|
||||
new_name = g_build_filename (*mc_config_migrate_rules[rule_index].new_basedir,
|
||||
mc_config_migrate_rules[rule_index].new_filename, NULL);
|
||||
new_name = g_build_filename (*mc_config_files_reference[rule_index].new_basedir,
|
||||
mc_config_files_reference[rule_index].new_filename, NULL);
|
||||
|
||||
mc_config_copy (old_name, new_name, error);
|
||||
|
||||
|
@ -451,3 +455,30 @@ mc_config_deprecated_dir_present (void)
|
|||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/**
|
||||
* Get full path to config file by short name.
|
||||
*
|
||||
* @param config_name short name
|
||||
* @return full path to config file
|
||||
*/
|
||||
|
||||
char *
|
||||
mc_config_get_full_path (const char *config_name)
|
||||
{
|
||||
size_t rule_index;
|
||||
|
||||
if (config_name == NULL)
|
||||
return NULL;
|
||||
|
||||
for (rule_index = 0; mc_config_files_reference[rule_index].old_filename != NULL; rule_index++)
|
||||
{
|
||||
if (strcmp (config_name, mc_config_files_reference[rule_index].new_filename) == 0)
|
||||
{
|
||||
return g_build_filename (*mc_config_files_reference[rule_index].new_basedir,
|
||||
mc_config_files_reference[rule_index].new_filename, NULL);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
|
|
@ -1277,7 +1277,7 @@ load_file_position (const char *filename, long *line, long *column, off_t * offs
|
|||
*offset = 0;
|
||||
|
||||
/* open file with positions */
|
||||
fn = g_build_filename (mc_config_get_cache_path (), MC_FILEPOS_FILE, NULL);
|
||||
fn = mc_config_get_full_path (MC_FILEPOS_FILE);
|
||||
f = fopen (fn, "r");
|
||||
g_free (fn);
|
||||
if (f == NULL)
|
||||
|
@ -1367,7 +1367,7 @@ save_file_position (const char *filename, long line, long column, off_t offset,
|
|||
filepos_max_saved_entries = mc_config_get_int (mc_main_config, CONFIG_APP_SECTION,
|
||||
"filepos_max_saved_entries", 1024);
|
||||
|
||||
fn = g_build_filename (mc_config_get_cache_path (), MC_FILEPOS_FILE, NULL);
|
||||
fn = mc_config_get_full_path (MC_FILEPOS_FILE);
|
||||
if (fn == NULL)
|
||||
goto early_error;
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ dlg_read_history (Dlg_head * h)
|
|||
if (num_history_items_recorded == 0) /* this is how to disable */
|
||||
return;
|
||||
|
||||
profile = g_build_filename (mc_config_get_cache_path (), MC_HISTORY_FILE, NULL);
|
||||
profile = mc_config_get_full_path (MC_HISTORY_FILE);
|
||||
event_data.cfg = mc_config_init (profile);
|
||||
event_data.receiver = NULL;
|
||||
|
||||
|
@ -1192,7 +1192,7 @@ dlg_save_history (Dlg_head * h)
|
|||
if (num_history_items_recorded == 0) /* this is how to disable */
|
||||
return;
|
||||
|
||||
profile = g_build_filename (mc_config_get_cache_path (), MC_HISTORY_FILE, (char *) NULL);
|
||||
profile = mc_config_get_full_path (MC_HISTORY_FILE);
|
||||
i = open (profile, O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
|
||||
if (i != -1)
|
||||
close (i);
|
||||
|
|
|
@ -150,7 +150,7 @@ history_get (const char *input_name)
|
|||
if ((input_name == NULL) || (*input_name == '\0'))
|
||||
return NULL;
|
||||
|
||||
profile = g_build_filename (mc_config_get_cache_path (), MC_HISTORY_FILE, NULL);
|
||||
profile = mc_config_get_full_path (MC_HISTORY_FILE);
|
||||
cfg = mc_config_init (profile);
|
||||
|
||||
hist = history_load (cfg, input_name);
|
||||
|
@ -303,7 +303,7 @@ history_put (const char *input_name, GList * h)
|
|||
if (h == NULL)
|
||||
return;
|
||||
|
||||
profile = g_build_filename (mc_config_get_cache_path (), MC_HISTORY_FILE, (char *) NULL);
|
||||
profile = mc_config_get_full_path (MC_HISTORY_FILE);
|
||||
|
||||
i = open (profile, O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
|
||||
if (i != -1)
|
||||
|
|
|
@ -77,7 +77,7 @@ clipboard_file_to_ext_clip (const gchar * event_group_name, const gchar * event_
|
|||
if (d == NULL || clipboard_store_path == NULL || clipboard_store_path[0] == '\0')
|
||||
return TRUE;
|
||||
|
||||
tmp = concat_dir_and_file (mc_config_get_cache_path (), EDIT_CLIP_FILE);
|
||||
tmp = mc_config_get_full_path (EDIT_CLIP_FILE);
|
||||
cmd = g_strconcat (clipboard_store_path, " ", tmp, " 2>/dev/null", (char *) NULL);
|
||||
|
||||
if (cmd != NULL)
|
||||
|
@ -107,7 +107,7 @@ clipboard_file_from_ext_clip (const gchar * event_group_name, const gchar * even
|
|||
if (d == NULL || clipboard_paste_path == NULL || clipboard_paste_path[0] == '\0')
|
||||
return TRUE;
|
||||
|
||||
tmp = concat_dir_and_file (mc_config_get_cache_path (), EDIT_CLIP_FILE);
|
||||
tmp = mc_config_get_full_path (EDIT_CLIP_FILE);
|
||||
cmd = g_strconcat (clipboard_paste_path, " > ", tmp, " 2>/dev/null", (char *) NULL);
|
||||
|
||||
if (cmd != NULL)
|
||||
|
@ -138,7 +138,7 @@ clipboard_text_to_file (const gchar * event_group_name, const gchar * event_name
|
|||
if (text == NULL)
|
||||
return FALSE;
|
||||
|
||||
fname = g_build_filename (mc_config_get_cache_path (), EDIT_CLIP_FILE, NULL);
|
||||
fname = mc_config_get_full_path (EDIT_CLIP_FILE);
|
||||
file = mc_open (fname, O_CREAT | O_WRONLY | O_TRUNC,
|
||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH | O_BINARY);
|
||||
g_free (fname);
|
||||
|
@ -169,7 +169,7 @@ clipboard_text_from_file (const gchar * event_group_name, const gchar * event_na
|
|||
(void) event_name;
|
||||
(void) init_data;
|
||||
|
||||
fname = g_build_filename (mc_config_get_cache_path (), EDIT_CLIP_FILE, NULL);
|
||||
fname = mc_config_get_full_path (EDIT_CLIP_FILE);
|
||||
f = fopen (fname, "r");
|
||||
g_free (fname);
|
||||
|
||||
|
|
|
@ -714,10 +714,10 @@ edit_get_prev_utf (WEdit * edit, long byte_index, int *char_width)
|
|||
cursor_buf_ptr = utf8_buf + (2 * UTF8_CHAR_LEN);
|
||||
str = g_utf8_find_prev_char (utf8_buf, cursor_buf_ptr);
|
||||
|
||||
if (str == NULL || g_utf8_next_char(str) != cursor_buf_ptr)
|
||||
if (str == NULL || g_utf8_next_char (str) != cursor_buf_ptr)
|
||||
{
|
||||
*char_width = 1;
|
||||
return *(cursor_buf_ptr-1);
|
||||
return *(cursor_buf_ptr - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -726,7 +726,7 @@ edit_get_prev_utf (WEdit * edit, long byte_index, int *char_width)
|
|||
if (res < 0)
|
||||
{
|
||||
*char_width = 1;
|
||||
return *(cursor_buf_ptr-1);
|
||||
return *(cursor_buf_ptr - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1833,7 +1833,7 @@ user_menu (WEdit * edit, const char *menu_file, int selected_entry)
|
|||
long start_mark, end_mark;
|
||||
struct stat status;
|
||||
|
||||
block_file = concat_dir_and_file (mc_config_get_cache_path (), EDIT_BLOCK_FILE);
|
||||
block_file = mc_config_get_full_path (EDIT_BLOCK_FILE);
|
||||
curs = edit->curs1;
|
||||
nomark = eval_marks (edit, &start_mark, &end_mark);
|
||||
if (nomark == 0)
|
||||
|
|
|
@ -525,7 +525,7 @@ edit_load_syntax_file (WEdit * edit)
|
|||
{
|
||||
char *buffer;
|
||||
|
||||
buffer = concat_dir_and_file (mc_config_get_data_path (), EDIT_SYNTAX_FILE);
|
||||
buffer = mc_config_get_full_path (EDIT_SYNTAX_FILE);
|
||||
check_for_default (extdir, buffer);
|
||||
edit_load_file_from_filename (edit, buffer);
|
||||
g_free (buffer);
|
||||
|
@ -566,7 +566,7 @@ edit_load_menu_file (WEdit * edit)
|
|||
break;
|
||||
|
||||
case 1:
|
||||
buffer = concat_dir_and_file (mc_config_get_data_path (), EDIT_HOME_MENU);
|
||||
buffer = mc_config_get_full_path (EDIT_HOME_MENU);
|
||||
check_for_default (menufile, buffer);
|
||||
break;
|
||||
|
||||
|
@ -937,7 +937,7 @@ edit_save_block_to_clip_file (WEdit * edit, long start, long finish)
|
|||
{
|
||||
int ret;
|
||||
gchar *tmp;
|
||||
tmp = concat_dir_and_file (mc_config_get_cache_path (), EDIT_CLIP_FILE);
|
||||
tmp = mc_config_get_full_path (EDIT_CLIP_FILE);
|
||||
ret = edit_save_block (edit, tmp, start, finish);
|
||||
g_free (tmp);
|
||||
return ret;
|
||||
|
@ -1311,7 +1311,7 @@ edit_delete_macro (WEdit * edit, int hotkey)
|
|||
edit_macro_sort_by_hotkey ();
|
||||
}
|
||||
|
||||
macros_fname = g_build_filename (mc_config_get_data_path (), MC_MACRO_FILE, (char *) NULL);
|
||||
macros_fname = mc_config_get_full_path (MC_MACRO_FILE);
|
||||
macros_config = mc_config_init (macros_fname);
|
||||
g_free (macros_fname);
|
||||
|
||||
|
@ -1645,7 +1645,7 @@ edit_store_macro_cmd (WEdit * edit)
|
|||
|
||||
edit_delete_macro (edit, hotkey);
|
||||
|
||||
macros_fname = g_build_filename (mc_config_get_data_path (), MC_MACRO_FILE, (char *) NULL);
|
||||
macros_fname = mc_config_get_full_path (MC_MACRO_FILE);
|
||||
macros_config = mc_config_init (macros_fname);
|
||||
g_free (macros_fname);
|
||||
|
||||
|
@ -1749,7 +1749,7 @@ edit_load_macro_cmd (WEdit * edit)
|
|||
|
||||
(void) edit;
|
||||
|
||||
macros_fname = g_build_filename (mc_config_get_data_path (), MC_MACRO_FILE, (char *) NULL);
|
||||
macros_fname = mc_config_get_full_path (MC_MACRO_FILE);
|
||||
macros_config = mc_config_init (macros_fname);
|
||||
g_free (macros_fname);
|
||||
|
||||
|
@ -2683,7 +2683,7 @@ edit_paste_from_X_buf_cmd (WEdit * edit)
|
|||
gchar *tmp;
|
||||
/* try use external clipboard utility */
|
||||
mc_event_raise (MCEVENT_GROUP_CORE, "clipboard_file_from_ext_clip", NULL);
|
||||
tmp = concat_dir_and_file (mc_config_get_cache_path (), EDIT_CLIP_FILE);
|
||||
tmp = mc_config_get_full_path (EDIT_CLIP_FILE);
|
||||
edit_insert_file (edit, tmp);
|
||||
g_free (tmp);
|
||||
}
|
||||
|
@ -2744,7 +2744,7 @@ edit_save_block_cmd (WEdit * edit)
|
|||
if (eval_marks (edit, &start_mark, &end_mark))
|
||||
return 1;
|
||||
|
||||
tmp = concat_dir_and_file (mc_config_get_cache_path (), EDIT_CLIP_FILE);
|
||||
tmp = mc_config_get_full_path (EDIT_CLIP_FILE);
|
||||
exp =
|
||||
input_expand_dialog (_("Save block"), _("Enter file name:"),
|
||||
MC_HISTORY_EDIT_SAVE_BLOCK, tmp);
|
||||
|
@ -2786,7 +2786,7 @@ edit_insert_file_cmd (WEdit * edit)
|
|||
gchar *tmp;
|
||||
char *exp;
|
||||
|
||||
tmp = concat_dir_and_file (mc_config_get_cache_path (), EDIT_CLIP_FILE);
|
||||
tmp = mc_config_get_full_path (EDIT_CLIP_FILE);
|
||||
exp = input_expand_dialog (_("Insert file"), _("Enter file name:"),
|
||||
MC_HISTORY_EDIT_INSERT_FILE, tmp);
|
||||
g_free (tmp);
|
||||
|
@ -2824,7 +2824,7 @@ int
|
|||
edit_sort_cmd (WEdit * edit)
|
||||
{
|
||||
static char *old = 0;
|
||||
char *exp, *tmp;
|
||||
char *exp, *tmp, *tmp_edit_block_name, *tmp_edit_temp_name;
|
||||
long start_mark, end_mark;
|
||||
int e;
|
||||
|
||||
|
@ -2834,7 +2834,7 @@ edit_sort_cmd (WEdit * edit)
|
|||
return 0;
|
||||
}
|
||||
|
||||
tmp = concat_dir_and_file (mc_config_get_cache_path (), EDIT_BLOCK_FILE);
|
||||
tmp = mc_config_get_full_path (EDIT_BLOCK_FILE);
|
||||
edit_save_block (edit, tmp, start_mark, end_mark);
|
||||
g_free (tmp);
|
||||
|
||||
|
@ -2846,10 +2846,14 @@ edit_sort_cmd (WEdit * edit)
|
|||
return 1;
|
||||
g_free (old);
|
||||
old = exp;
|
||||
tmp_edit_block_name = mc_config_get_full_path (EDIT_BLOCK_FILE);
|
||||
tmp_edit_temp_name = mc_config_get_full_path (EDIT_TEMP_FILE);
|
||||
tmp =
|
||||
g_strconcat (" sort ", exp, " ", mc_config_get_cache_path (), PATH_SEP_STR EDIT_BLOCK_FILE,
|
||||
" > ", mc_config_get_cache_path (), PATH_SEP_STR EDIT_TEMP_FILE,
|
||||
(char *) NULL);
|
||||
g_strconcat (" sort ", exp, " ", tmp_edit_block_name,
|
||||
" > ", tmp_edit_temp_name, (char *) NULL);
|
||||
g_free (tmp_edit_temp_name);
|
||||
g_free (tmp_edit_block_name);
|
||||
|
||||
e = system (tmp);
|
||||
g_free (tmp);
|
||||
if (e)
|
||||
|
@ -2873,7 +2877,7 @@ edit_sort_cmd (WEdit * edit)
|
|||
|
||||
if (edit_block_delete_cmd (edit))
|
||||
return 1;
|
||||
tmp = concat_dir_and_file (mc_config_get_cache_path (), EDIT_TEMP_FILE);
|
||||
tmp = mc_config_get_full_path (EDIT_TEMP_FILE);
|
||||
edit_insert_file (edit, tmp);
|
||||
g_free (tmp);
|
||||
return 0;
|
||||
|
@ -2888,7 +2892,7 @@ edit_sort_cmd (WEdit * edit)
|
|||
int
|
||||
edit_ext_cmd (WEdit * edit)
|
||||
{
|
||||
char *exp, *tmp;
|
||||
char *exp, *tmp, *tmp_edit_temp_file;
|
||||
int e;
|
||||
|
||||
exp =
|
||||
|
@ -2898,9 +2902,9 @@ edit_ext_cmd (WEdit * edit)
|
|||
if (!exp)
|
||||
return 1;
|
||||
|
||||
tmp =
|
||||
g_strconcat (exp, " > ", mc_config_get_cache_path (), PATH_SEP_STR EDIT_TEMP_FILE,
|
||||
(char *) NULL);
|
||||
tmp_edit_temp_file = mc_config_get_full_path (EDIT_TEMP_FILE);
|
||||
tmp = g_strconcat (exp, " > ", tmp_edit_temp_file, (char *) NULL);
|
||||
g_free (tmp_edit_temp_file);
|
||||
e = system (tmp);
|
||||
g_free (tmp);
|
||||
g_free (exp);
|
||||
|
@ -2912,7 +2916,7 @@ edit_ext_cmd (WEdit * edit)
|
|||
}
|
||||
|
||||
edit->force |= REDRAW_COMPLETELY;
|
||||
tmp = concat_dir_and_file (mc_config_get_cache_path (), EDIT_TEMP_FILE);
|
||||
tmp = mc_config_get_full_path (EDIT_TEMP_FILE);
|
||||
edit_insert_file (edit, tmp);
|
||||
g_free (tmp);
|
||||
return 0;
|
||||
|
|
|
@ -1512,7 +1512,7 @@ edit_load_syntax (WEdit * edit, char ***pnames, const char *type)
|
|||
if (!*edit->filename && !type)
|
||||
return;
|
||||
}
|
||||
f = g_build_filename (mc_config_get_data_path (), EDIT_SYNTAX_FILE, (char *) NULL);
|
||||
f = mc_config_get_full_path (EDIT_SYNTAX_FILE);
|
||||
if (edit != NULL)
|
||||
r = edit_read_syntax_file (edit, pnames, f, edit->filename,
|
||||
get_first_editor_line (edit),
|
||||
|
|
|
@ -1069,7 +1069,7 @@ ext_cmd (void)
|
|||
|
||||
if (dir == 0)
|
||||
{
|
||||
buffer = g_build_filename (mc_config_get_data_path (), MC_FILEBIND_FILE, NULL);
|
||||
buffer = mc_config_get_full_path (MC_FILEBIND_FILE);
|
||||
check_for_default (extdir, buffer);
|
||||
do_edit (buffer);
|
||||
g_free (buffer);
|
||||
|
@ -1118,7 +1118,7 @@ edit_mc_menu_cmd (void)
|
|||
break;
|
||||
|
||||
case 1:
|
||||
buffer = g_build_filename (mc_config_get_data_path (), MC_USERMENU_FILE, NULL);
|
||||
buffer = mc_config_get_full_path (MC_USERMENU_FILE);
|
||||
check_for_default (menufile, buffer);
|
||||
break;
|
||||
|
||||
|
@ -1163,7 +1163,7 @@ edit_fhl_cmd (void)
|
|||
|
||||
if (dir == 0)
|
||||
{
|
||||
buffer = g_build_filename (mc_config_get_path (), MC_FHL_INI_FILE, NULL);
|
||||
buffer = mc_config_get_full_path (MC_FHL_INI_FILE);
|
||||
check_for_default (fhlfile, buffer);
|
||||
do_edit (buffer);
|
||||
g_free (buffer);
|
||||
|
@ -1615,7 +1615,7 @@ save_setup_cmd (void)
|
|||
char *d1;
|
||||
const char *d2;
|
||||
|
||||
d1 = g_build_filename (mc_config_get_path (), MC_CONFIG_FILE, (char *) NULL);
|
||||
d1 = mc_config_get_full_path (MC_CONFIG_FILE);
|
||||
d2 = strip_home_and_password (d1);
|
||||
g_free (d1);
|
||||
|
||||
|
|
|
@ -641,7 +641,7 @@ regex_command (const char *filename, const char *action, int *move_dir)
|
|||
int mc_user_ext = 1;
|
||||
int home_error = 0;
|
||||
|
||||
extension_file = g_build_filename (mc_config_get_data_path (), MC_FILEBIND_FILE, NULL);
|
||||
extension_file = mc_config_get_full_path (MC_FILEBIND_FILE);
|
||||
if (!exist_file (extension_file))
|
||||
{
|
||||
g_free (extension_file);
|
||||
|
@ -687,15 +687,14 @@ regex_command (const char *filename, const char *action, int *move_dir)
|
|||
}
|
||||
if (home_error)
|
||||
{
|
||||
char *title = g_strdup_printf (_("%s%s%s file error"),
|
||||
mc_config_get_data_path (), PATH_SEP_STR,
|
||||
MC_FILEBIND_FILE);
|
||||
char *filebind_filename = mc_config_get_full_path (MC_FILEBIND_FILE);
|
||||
char *title = g_strdup_printf (_("%s file error"), filebind_filename);
|
||||
message (D_ERROR, title,
|
||||
_("The format of the %s%s%s file has "
|
||||
_("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."),
|
||||
mc_config_get_data_path (), PATH_SEP_STR, MC_FILEBIND_FILE,
|
||||
mc_global.sysconfig_dir);
|
||||
filebind_filename, mc_global.sysconfig_dir);
|
||||
g_free (filebind_filename);
|
||||
g_free (title);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1564,7 +1564,7 @@ load_hotlist (void)
|
|||
}
|
||||
|
||||
if (!hotlist_file_name)
|
||||
hotlist_file_name = g_build_filename (mc_config_get_path (), MC_HOTLIST_FILE, NULL);
|
||||
hotlist_file_name = mc_config_get_full_path (MC_HOTLIST_FILE);
|
||||
|
||||
hotlist = new_hotlist ();
|
||||
hotlist->type = HL_TYPE_GROUP;
|
||||
|
|
|
@ -178,8 +178,7 @@ save_tree (WTree * tree)
|
|||
|
||||
if (error)
|
||||
{
|
||||
tree_name =
|
||||
g_build_filename (mc_config_get_cache_path (), MC_TREESTORE_FILE, (char *) NULL);
|
||||
tree_name = mc_config_get_full_path (MC_TREESTORE_FILE);
|
||||
fprintf (stderr, _("Cannot open the %s file for writing:\n%s\n"), tree_name,
|
||||
unix_error_string (error));
|
||||
g_free (tree_name);
|
||||
|
|
|
@ -647,7 +647,7 @@ tree_store_load (void)
|
|||
char *name;
|
||||
int retval;
|
||||
|
||||
name = g_build_filename (mc_config_get_cache_path (), MC_TREESTORE_FILE, NULL);
|
||||
name = mc_config_get_full_path (MC_TREESTORE_FILE);
|
||||
retval = tree_store_load_from (name);
|
||||
g_free (name);
|
||||
|
||||
|
@ -667,7 +667,7 @@ tree_store_save (void)
|
|||
char *name;
|
||||
int retval;
|
||||
|
||||
name = g_build_filename (mc_config_get_cache_path (), MC_TREESTORE_FILE, NULL);
|
||||
name = mc_config_get_full_path (MC_TREESTORE_FILE);
|
||||
mc_util_make_backup_if_possible (name, ".tmp");
|
||||
|
||||
retval = tree_store_save_to (name);
|
||||
|
|
|
@ -798,7 +798,7 @@ expand_format (struct WEdit *edit_widget, char c, gboolean do_quote)
|
|||
#ifdef USE_INTERNAL_EDIT
|
||||
if (edit_widget)
|
||||
{
|
||||
char *file = concat_dir_and_file (mc_config_get_cache_path (), EDIT_BLOCK_FILE);
|
||||
char *file = mc_config_get_full_path (EDIT_BLOCK_FILE);
|
||||
fname = (*quote_func) (file, 0);
|
||||
g_free (file);
|
||||
return fname;
|
||||
|
@ -897,9 +897,9 @@ user_menu_cmd (struct WEdit * edit_widget, const char *menu_file, int selected_e
|
|||
|
||||
g_free (menu);
|
||||
if (edit_widget)
|
||||
menu = concat_dir_and_file (mc_config_get_data_path (), EDIT_HOME_MENU);
|
||||
menu = mc_config_get_full_path (EDIT_HOME_MENU);
|
||||
else
|
||||
menu = g_build_filename (mc_config_get_data_path (), MC_USERMENU_FILE, NULL);
|
||||
menu = mc_config_get_full_path (MC_USERMENU_FILE);
|
||||
|
||||
|
||||
if (!exist_file (menu))
|
||||
|
|
11
src/setup.c
11
src/setup.c
|
@ -621,8 +621,7 @@ load_keymap_from_section (const char *section_name, GArray * keymap, mc_config_t
|
|||
{
|
||||
gchar **values, **curr_values;
|
||||
|
||||
curr_values = values =
|
||||
mc_config_get_string_list (cfg, section_name, *profile_keys, &len);
|
||||
curr_values = values = mc_config_get_string_list (cfg, section_name, *profile_keys, &len);
|
||||
|
||||
if (curr_values != NULL)
|
||||
{
|
||||
|
@ -672,7 +671,7 @@ load_setup_get_keymap_profile_config (gboolean load_from_file)
|
|||
g_free (fname);
|
||||
|
||||
/* 3) ${XDG_CONFIG_HOME}/mc */
|
||||
fname = g_build_filename (mc_config_get_path (), GLOBAL_KEYMAP_FILE, NULL);
|
||||
fname = mc_config_get_full_path (GLOBAL_KEYMAP_FILE);
|
||||
load_setup_init_config_from_file (&keymap_config, fname);
|
||||
g_free (fname);
|
||||
|
||||
|
@ -793,7 +792,7 @@ setup_init (void)
|
|||
if (profile_name != NULL)
|
||||
return profile_name;
|
||||
|
||||
profile = g_build_filename (mc_config_get_path (), MC_CONFIG_FILE, NULL);
|
||||
profile = mc_config_get_full_path (MC_CONFIG_FILE);
|
||||
if (!exist_file (profile))
|
||||
{
|
||||
inifile = concat_dir_and_file (mc_global.sysconfig_dir, "mc.ini");
|
||||
|
@ -848,7 +847,7 @@ load_setup (void)
|
|||
g_build_filename (mc_global.share_data_dir, MC_GLOBAL_CONFIG_FILE, (char *) NULL);
|
||||
}
|
||||
|
||||
panels_profile_name = g_build_filename (mc_config_get_cache_path (), MC_PANELS_FILE, NULL);
|
||||
panels_profile_name = mc_config_get_full_path (MC_PANELS_FILE);
|
||||
|
||||
mc_main_config = mc_config_init (profile);
|
||||
|
||||
|
@ -1005,7 +1004,7 @@ save_setup (gboolean save_options, gboolean save_panel_options)
|
|||
mc_config_set_string (mc_main_config, "Misc", "clipboard_store", clipboard_store_path);
|
||||
mc_config_set_string (mc_main_config, "Misc", "clipboard_paste", clipboard_paste_path);
|
||||
|
||||
tmp_profile = g_build_filename (mc_config_get_path (), MC_CONFIG_FILE, NULL);
|
||||
tmp_profile = mc_config_get_full_path (MC_CONFIG_FILE);
|
||||
ret = mc_config_save_to_file (mc_main_config, tmp_profile, NULL);
|
||||
g_free (tmp_profile);
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ init_subshell_child (const char *pty_name)
|
|||
switch (subshell_type)
|
||||
{
|
||||
case BASH:
|
||||
init_file = g_build_filename (mc_config_get_path (), "bashrc", NULL);
|
||||
init_file = mc_config_get_full_path ("bashrc");
|
||||
|
||||
if (access (init_file, R_OK) == -1)
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ init_subshell_child (const char *pty_name)
|
|||
|
||||
/* Allow alternative readline settings for MC */
|
||||
{
|
||||
char *input_file = g_build_filename (mc_config_get_path (), "inputrc", NULL);
|
||||
char *input_file = mc_config_get_full_path ("inputrc");
|
||||
if (access (input_file, R_OK) == 0)
|
||||
{
|
||||
char *putenv_str = g_strconcat ("INPUTRC=", input_file, NULL);
|
||||
|
|
Loading…
Reference in New Issue