Renamed variables mc_home to mc_sysconfig_dir and mc_home_alt to mc_share_data_dir for more sence

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2010-12-30 12:35:33 +02:00
parent acbe048486
commit f31863a80a
15 changed files with 66 additions and 65 deletions

View File

@ -200,12 +200,12 @@ load_codepages_list (void)
char *fname;
/* 1: try load /usr/share/mc/mc.charsets */
fname = g_build_filename (mc_home_alt, CHARSETS_LIST, (char *) NULL);
fname = g_build_filename (mc_share_data_dir, CHARSETS_LIST, (char *) NULL);
load_codepages_list_from_file (&codepages, fname);
g_free (fname);
/* 2: try load /etc/mc/mc.charsets */
fname = g_build_filename (mc_home, CHARSETS_LIST, (char *) NULL);
fname = g_build_filename (mc_sysconfig_dir, CHARSETS_LIST, (char *) NULL);
load_codepages_list_from_file (&codepages, fname);
g_free (fname);

View File

@ -209,14 +209,14 @@ mc_fhl_init_from_standard_files (mc_fhl_t * fhl)
return TRUE;
/* ${sysconfdir}/mc/filehighlight.ini */
name = g_build_filename (mc_home, MC_FHL_INI_FILE, (char *) NULL);
name = g_build_filename (mc_sysconfig_dir, MC_FHL_INI_FILE, (char *) NULL);
ok = mc_fhl_read_ini_file (fhl, name);
g_free (name);
if (ok)
return TRUE;
/* ${datadir}/mc/filehighlight.ini */
name = g_build_filename (mc_home_alt, MC_FHL_INI_FILE, (char *) NULL);
name = g_build_filename (mc_share_data_dir, MC_FHL_INI_FILE, (char *) NULL);
ok = mc_fhl_read_ini_file (fhl, name);
g_free (name);
return ok;

View File

@ -102,11 +102,11 @@ mc_skin_ini_file_load (mc_skin_t * mc_skin)
return TRUE;
/* /etc/mc/skins/ */
if (mc_skin_ini_file_load_search_in_dir (mc_skin, mc_home))
if (mc_skin_ini_file_load_search_in_dir (mc_skin, mc_sysconfig_dir))
return TRUE;
/* /usr/share/mc/skins/ */
return mc_skin_ini_file_load_search_in_dir (mc_skin, mc_home_alt);
return mc_skin_ini_file_load_search_in_dir (mc_skin, mc_share_data_dir);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -667,7 +667,7 @@ ftpfs_load_no_proxy_list (void)
if (mc_file)
return;
mc_file = concat_dir_and_file (mc_home, "mc.no_proxy");
mc_file = concat_dir_and_file (mc_sysconfig_dir, "mc.no_proxy");
if (exist_file (mc_file))
{
npf = fopen (mc_file, "r");

View File

@ -45,7 +45,7 @@
#include "lib/util.h"
#include "lib/widget.h" /* D_ERROR, D_NORMAL */
#include "src/main.h" /* mc_home */
#include "src/main.h" /* mc_sysconfig_dir */
#include "src/execute.h" /* EXECUTE_AS_SHELL */
#include "vfs-impl.h"
@ -415,7 +415,7 @@ sfs_init (struct vfs_class *me)
(void) me;
mc_sfsini = g_build_filename (mc_home, "sfs.ini", (char *) NULL);
mc_sfsini = g_build_filename (mc_sysconfig_dir, "sfs.ini", (char *) NULL);
cfg = fopen (mc_sfsini, "r");
if (cfg == NULL)

View File

@ -567,7 +567,7 @@ mc_args_process (int argc, char *argv[])
}
if (mc_args__show_datadirs)
{
printf ("%s (%s)\n", mc_home, mc_home_alt);
printf ("%s (%s)\n", mc_sysconfig_dir, mc_share_data_dir);
return FALSE;
}

View File

@ -60,7 +60,7 @@
#include "src/filemanager/layout.h" /* clr_scr() */
#include "src/history.h"
#include "src/main.h" /* mc_home, midnight_shutdown */
#include "src/main.h" /* mc_sysconfig_dir, midnight_shutdown */
#include "src/setup.h" /* option_tab_spacing */
#include "src/help.h" /* interactive_display() */
#include "src/selcodepage.h"
@ -635,11 +635,11 @@ edit_load_syntax_file (WEdit * edit)
_("&User"), _("&System Wide"));
}
extdir = g_build_filename (mc_home, "syntax", "Syntax", (char *) NULL);
extdir = g_build_filename (mc_sysconfig_dir, "syntax", "Syntax", (char *) NULL);
if (!exist_file (extdir))
{
g_free (extdir);
extdir = g_build_filename (mc_home_alt, "syntax", "Syntax", (char *) NULL);
extdir = g_build_filename (mc_share_data_dir, "syntax", "Syntax", (char *) NULL);
}
if (dir == 0)
@ -670,12 +670,12 @@ edit_load_menu_file (WEdit * edit)
_("Which menu file do you want to edit?"), D_NORMAL,
geteuid () != 0 ? 2 : 3, _("&Local"), _("&User"), _("&System Wide"));
menufile = concat_dir_and_file (mc_home, EDIT_GLOBAL_MENU);
menufile = concat_dir_and_file (mc_sysconfig_dir, EDIT_GLOBAL_MENU);
if (!exist_file (menufile))
{
g_free (menufile);
menufile = concat_dir_and_file (mc_home_alt, EDIT_GLOBAL_MENU);
menufile = concat_dir_and_file (mc_share_data_dir, EDIT_GLOBAL_MENU);
}
switch (dir)
@ -692,11 +692,11 @@ edit_load_menu_file (WEdit * edit)
break;
case 2:
buffer = concat_dir_and_file (mc_home, EDIT_GLOBAL_MENU);
buffer = concat_dir_and_file (mc_sysconfig_dir, EDIT_GLOBAL_MENU);
if (!exist_file (buffer))
{
g_free (buffer);
buffer = concat_dir_and_file (mc_home_alt, EDIT_GLOBAL_MENU);
buffer = concat_dir_and_file (mc_share_data_dir, EDIT_GLOBAL_MENU);
}
break;
@ -2750,7 +2750,7 @@ edit_block_process_cmd (WEdit * edit, const char *shell_cmd, int block)
gchar *o, *h, *b, *tmp;
char *quoted_name = NULL;
o = g_strconcat (mc_home, shell_cmd, (char *) NULL); /* original source script */
o = g_strconcat (mc_sysconfig_dir, shell_cmd, (char *) NULL); /* original source script */
h = g_strconcat (mc_config_get_data_path (), PATH_SEP_STR EDIT_DIR, shell_cmd, (char *) NULL); /* home script */
b = concat_dir_and_file (mc_config_get_cache_path (), EDIT_BLOCK_FILE); /* block file */
@ -2771,7 +2771,7 @@ edit_block_process_cmd (WEdit * edit, const char *shell_cmd, int block)
script_src = fopen (o, "r");
if (script_src == NULL)
{
o = g_strconcat (mc_home_alt, shell_cmd, (char *) NULL);
o = g_strconcat (mc_share_data_dir, shell_cmd, (char *) NULL);
script_src = fopen (o, "r");
if (script_src == NULL)
{

View File

@ -57,7 +57,7 @@
#include "lib/util.h"
#include "lib/widget.h" /* message() */
#include "src/main.h" /* mc_home */
#include "src/main.h" /* mc_sysconfig_dir */
#include "edit-impl.h"
#include "edit-widget.h"
@ -859,13 +859,13 @@ open_include_file (const char *filename)
return f;
g_free (error_file_name);
error_file_name = g_build_filename (mc_home, "syntax", filename, (char *) NULL);
error_file_name = g_build_filename (mc_sysconfig_dir, "syntax", filename, (char *) NULL);
f = fopen (error_file_name, "r");
if (f != NULL)
return f;
g_free (error_file_name);
error_file_name = g_build_filename (mc_home_alt, "syntax", filename, (char *) NULL);
error_file_name = g_build_filename (mc_share_data_dir, "syntax", filename, (char *) NULL);
return fopen (error_file_name, "r");
}
@ -1267,7 +1267,7 @@ edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file,
f = fopen (syntax_file, "r");
if (f == NULL)
{
lib_file = g_build_filename (mc_home_alt, "syntax", "Syntax", (char *) NULL);
lib_file = g_build_filename (mc_share_data_dir, "syntax", "Syntax", (char *) NULL);
f = fopen (lib_file, "r");
g_free (lib_file);
if (f == NULL)

View File

@ -1020,7 +1020,7 @@ ext_cmd (void)
_("Which extension file you want to edit?"), D_NORMAL, 2,
_("&User"), _("&System Wide"));
}
extdir = concat_dir_and_file (mc_home, MC_LIB_EXT);
extdir = concat_dir_and_file (mc_sysconfig_dir, MC_LIB_EXT);
if (dir == 0)
{
@ -1034,7 +1034,7 @@ ext_cmd (void)
if (!exist_file (extdir))
{
g_free (extdir);
extdir = concat_dir_and_file (mc_home_alt, MC_LIB_EXT);
extdir = concat_dir_and_file (mc_share_data_dir, MC_LIB_EXT);
}
do_edit (extdir);
}
@ -1056,12 +1056,12 @@ edit_mc_menu_cmd (void)
_("Which menu file do you want to edit?"),
D_NORMAL, geteuid ()? 2 : 3, _("&Local"), _("&User"), _("&System Wide"));
menufile = concat_dir_and_file (mc_home, MC_GLOBAL_MENU);
menufile = concat_dir_and_file (mc_sysconfig_dir, MC_GLOBAL_MENU);
if (!exist_file (menufile))
{
g_free (menufile);
menufile = concat_dir_and_file (mc_home_alt, MC_GLOBAL_MENU);
menufile = concat_dir_and_file (mc_share_data_dir, MC_GLOBAL_MENU);
}
switch (dir)
@ -1078,11 +1078,11 @@ edit_mc_menu_cmd (void)
break;
case 2:
buffer = concat_dir_and_file (mc_home, MC_GLOBAL_MENU);
buffer = concat_dir_and_file (mc_sysconfig_dir, MC_GLOBAL_MENU);
if (!exist_file (buffer))
{
g_free (buffer);
buffer = concat_dir_and_file (mc_home_alt, MC_GLOBAL_MENU);
buffer = concat_dir_and_file (mc_share_data_dir, MC_GLOBAL_MENU);
}
break;
@ -1114,7 +1114,7 @@ edit_fhl_cmd (void)
_("Which highlighting file you want to edit?"), D_NORMAL, 2,
_("&User"), _("&System Wide"));
}
fhlfile = concat_dir_and_file (mc_home, MC_FHL_INI_FILE);
fhlfile = concat_dir_and_file (mc_sysconfig_dir, MC_FHL_INI_FILE);
if (dir == 0)
{
@ -1128,7 +1128,7 @@ edit_fhl_cmd (void)
if (!exist_file (fhlfile))
{
g_free (fhlfile);
fhlfile = concat_dir_and_file (mc_home, MC_FHL_INI_FILE);
fhlfile = concat_dir_and_file (mc_sysconfig_dir, MC_FHL_INI_FILE);
}
do_edit (fhlfile);
}
@ -1365,7 +1365,7 @@ get_random_hint (int force)
return g_strdup ("");
last_sec = tv.tv_sec;
data = load_mc_home_file (mc_home_alt, MC_HINT, NULL);
data = load_mc_home_file (mc_share_data_dir, MC_HINT, NULL);
if (data == NULL)
return NULL;

View File

@ -635,11 +635,11 @@ regex_command (const char *filename, const char *action, int *move_dir)
{
g_free (extension_file);
check_stock_mc_ext:
extension_file = concat_dir_and_file (mc_home, MC_LIB_EXT);
extension_file = concat_dir_and_file (mc_sysconfig_dir, MC_LIB_EXT);
if (!exist_file (extension_file))
{
g_free (extension_file);
extension_file = concat_dir_and_file (mc_home_alt, MC_LIB_EXT);
extension_file = concat_dir_and_file (mc_share_data_dir, MC_LIB_EXT);
}
mc_user_ext = 0;
}
@ -663,12 +663,12 @@ regex_command (const char *filename, const char *action, int *move_dir)
else
{
char *title = g_strdup_printf (_(" %s%s file error"),
mc_home, MC_LIB_EXT);
mc_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_home);
mc_sysconfig_dir);
g_free (title);
return 0;
}
@ -683,7 +683,7 @@ regex_command (const char *filename, const char *action, int *move_dir)
_("The format of the %s%s%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_home);
mc_config_get_data_path (), PATH_SEP_STR, MC_FILEBIND_FILE, mc_sysconfig_dir);
g_free (title);
}
}

View File

@ -887,7 +887,7 @@ user_menu_cmd (struct WEdit *edit_widget)
{
g_free (menu);
menu = concat_dir_and_file
(mc_home_alt, edit_widget ? EDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
(mc_share_data_dir, edit_widget ? EDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
}
}
}

View File

@ -1047,7 +1047,7 @@ interactive_display (const char *filename, const char *node)
if (filename != NULL)
g_file_get_contents (filename, &filedata, NULL, NULL);
else
filedata = load_mc_home_file (mc_home_alt, MC_HELP, &hlpfile);
filedata = load_mc_home_file (mc_share_data_dir, MC_HELP, &hlpfile);
if (filedata == NULL)
message (D_ERROR, MSG_ERROR, _("Cannot open file %s\n%s"),

View File

@ -119,10 +119,13 @@ char *shell = NULL;
/* The prompt */
const char *mc_prompt = NULL;
/* mc_home: The home of MC - /etc/mc or defined by MC_DATADIR */
char *mc_home = NULL;
/* mc_home_alt: Alternative home of MC - deprecated /usr/share/mc */
char *mc_home_alt = NULL;
/* mc_sysconfig_dir: Area for default settings from maintainers of distributuves
default is /etc/mc or may be defined by MC_DATADIR
*/
char *mc_sysconfig_dir = NULL;
/* mc_share_data_dir: Area for default settings from developers */
char *mc_share_data_dir = NULL;
/* Set to TRUE to suppress printing the last directory */
int print_last_revert = FALSE;
@ -196,13 +199,13 @@ OS_Setup (void)
mc_libdir = getenv ("MC_DATADIR");
if (mc_libdir != NULL)
{
mc_home = g_strdup (mc_libdir);
mc_home_alt = g_strdup (SYSCONFDIR);
mc_sysconfig_dir = g_strdup (mc_libdir);
mc_share_data_dir = g_strdup (SYSCONFDIR);
}
else
{
mc_home = g_strdup (SYSCONFDIR);
mc_home_alt = g_strdup (DATADIR);
mc_sysconfig_dir = g_strdup (SYSCONFDIR);
mc_share_data_dir = g_strdup (DATADIR);
}
}
@ -578,8 +581,8 @@ main (int argc, char *argv[])
}
g_free (last_wd_string);
g_free (mc_home_alt);
g_free (mc_home);
g_free (mc_share_data_dir);
g_free (mc_sysconfig_dir);
g_free (shell);
done_key ();

View File

@ -78,8 +78,8 @@ extern int midnight_shutdown;
extern char *shell;
extern const char *mc_prompt;
extern char *mc_home;
extern char *mc_home_alt;
extern char *mc_sysconfig_dir;
extern char *mc_share_data_dir;
/*** declarations of public functions ************************************************************/

View File

@ -390,8 +390,6 @@ load_setup_get_full_config_name (const char *subdir, const char *config_file_nam
{
/*
TODO: IMHO, in future this function must be placed into mc_config module.
Also, need to rename stupid mc_home and mc_home_alt to mc_sysconfdir and mc_datadir;
home_mc => mc_user_homedir
*/
char *lc_basename, *ret;
@ -419,9 +417,9 @@ load_setup_get_full_config_name (const char *subdir, const char *config_file_nam
g_free (ret);
if (subdir != NULL)
ret = g_build_filename (mc_home, subdir, lc_basename, NULL);
ret = g_build_filename (mc_sysconfig_dir, subdir, lc_basename, NULL);
else
ret = g_build_filename (mc_home, lc_basename, NULL);
ret = g_build_filename (mc_sysconfig_dir, lc_basename, NULL);
if (exist_file (ret))
{
@ -431,9 +429,9 @@ load_setup_get_full_config_name (const char *subdir, const char *config_file_nam
g_free (ret);
if (subdir != NULL)
ret = g_build_filename (mc_home_alt, subdir, lc_basename, NULL);
ret = g_build_filename (mc_share_data_dir, subdir, lc_basename, NULL);
else
ret = g_build_filename (mc_home_alt, lc_basename, NULL);
ret = g_build_filename (mc_share_data_dir, lc_basename, NULL);
g_free (lc_basename);
@ -678,13 +676,13 @@ load_setup_get_keymap_profile_config (void)
mc_config_t *keymap_config = NULL;
char *fname, *fname2;
/* 1) /usr/share/mc (mc_home_alt) */
fname = g_build_filename (mc_home_alt, GLOBAL_KEYMAP_FILE, NULL);
/* 1) /usr/share/mc (mc_share_data_dir) */
fname = g_build_filename (mc_share_data_dir, GLOBAL_KEYMAP_FILE, NULL);
load_setup_init_config_from_file (&keymap_config, fname);
g_free (fname);
/* 2) /etc/mc (mc_home) */
fname = g_build_filename (mc_home, GLOBAL_KEYMAP_FILE, NULL);
/* 2) /etc/mc (mc_sysconfig_dir) */
fname = g_build_filename (mc_sysconfig_dir, GLOBAL_KEYMAP_FILE, NULL);
load_setup_init_config_from_file (&keymap_config, fname);
g_free (fname);
@ -814,7 +812,7 @@ setup_init (void)
profile = g_build_filename (mc_config_get_path (), MC_CONFIG_FILE, NULL);
if (!exist_file (profile))
{
inifile = concat_dir_and_file (mc_home, "mc.ini");
inifile = concat_dir_and_file (mc_sysconfig_dir, "mc.ini");
if (exist_file (inifile))
{
g_free (profile);
@ -823,7 +821,7 @@ setup_init (void)
else
{
g_free (inifile);
inifile = concat_dir_and_file (mc_home_alt, "mc.ini");
inifile = concat_dir_and_file (mc_share_data_dir, "mc.ini");
if (exist_file (inifile))
{
g_free (profile);
@ -857,11 +855,11 @@ load_setup (void)
/* mc.lib is common for all users, but has priority lower than
~/.mc/ini. FIXME: it's only used for keys and treestore now */
global_profile_name = g_build_filename (mc_home, MC_GLOBAL_CONFIG_FILE, (char *) NULL);
global_profile_name = g_build_filename (mc_sysconfig_dir, MC_GLOBAL_CONFIG_FILE, (char *) NULL);
if (!exist_file (global_profile_name))
{
g_free (global_profile_name);
global_profile_name = g_build_filename (mc_home_alt, MC_GLOBAL_CONFIG_FILE, (char *) NULL);
global_profile_name = g_build_filename (mc_share_data_dir, MC_GLOBAL_CONFIG_FILE, (char *) NULL);
}
panels_profile_name = g_build_filename (mc_config_get_cache_path (), MC_PANELS_FILE, NULL);