mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-18 09:19:24 +03:00
Merge branch '1851_xdg_fix'
* 1851_xdg_fix: Tweak description of MC_HOME environment variable. Ticket #1851: fixed support of XDG_* shell variables
This commit is contained in:
commit
ce401d7974
@ -3727,8 +3727,8 @@ personal o de sistema.
|
|||||||
To change default home directory of MC, you can use
|
To change default home directory of MC, you can use
|
||||||
.BR MC_HOME
|
.BR MC_HOME
|
||||||
environment variable. The value of MC_HOME must be an absolute path. If MC_HOME
|
environment variable. The value of MC_HOME must be an absolute path. If MC_HOME
|
||||||
variable is unset or empty, HOME variable is used. If HOME variable is unset
|
is unset or empty, HOME variable is used. If HOME is unset or empty, MC
|
||||||
or empty, MC home directory is get from GLib library.
|
directories are get from GLib library.
|
||||||
.\"SKIP_SECTION"
|
.\"SKIP_SECTION"
|
||||||
.SH "LICENCIA"
|
.SH "LICENCIA"
|
||||||
Este programa se distribuye en los términos que recoge la Licencia Pública
|
Este programa se distribuye en los términos que recoge la Licencia Pública
|
||||||
|
@ -3242,8 +3242,8 @@ használja a home, vagy rendszerszintű alkalmazás menü helyett.
|
|||||||
To change default home directory of MC, you can use
|
To change default home directory of MC, you can use
|
||||||
.BR MC_HOME
|
.BR MC_HOME
|
||||||
environment variable. The value of MC_HOME must be an absolute path. If MC_HOME
|
environment variable. The value of MC_HOME must be an absolute path. If MC_HOME
|
||||||
variable is unset or empty, HOME variable is used. If HOME variable is unset
|
is unset or empty, HOME variable is used. If HOME is unset or empty, MC
|
||||||
or empty, MC home directory is get from GLib library.
|
directories are get from GLib library.
|
||||||
.\"NODE "AVAILABILITY"
|
.\"NODE "AVAILABILITY"
|
||||||
.SH "A Midnight Commander frissítése"
|
.SH "A Midnight Commander frissítése"
|
||||||
A program legutolsó verzióját az ftp.nuclecu.unam.mx címen a
|
A program legutolsó verzióját az ftp.nuclecu.unam.mx címen a
|
||||||
|
@ -3231,8 +3231,8 @@ al posto del menu delle applicazioni utente o di sistema.
|
|||||||
To change default home directory of MC, you can use
|
To change default home directory of MC, you can use
|
||||||
.BR MC_HOME
|
.BR MC_HOME
|
||||||
environment variable. The value of MC_HOME must be an absolute path. If MC_HOME
|
environment variable. The value of MC_HOME must be an absolute path. If MC_HOME
|
||||||
variable is unset or empty, HOME variable is used. If HOME variable is unset
|
is unset or empty, HOME variable is used. If HOME is unset or empty, MC
|
||||||
or empty, MC home directory is get from GLib library.
|
directories are get from GLib library.
|
||||||
.\"SKIP_SECTION"
|
.\"SKIP_SECTION"
|
||||||
.SH "LICENZA"
|
.SH "LICENZA"
|
||||||
Questo programma è distribuito sotto i termini della Licenza Generale
|
Questo programma è distribuito sotto i termini della Licenza Generale
|
||||||
|
@ -4161,11 +4161,11 @@ The directory list for the directory tree and tree view features.
|
|||||||
Local user\-defined menu. If this file is present, it is used instead of
|
Local user\-defined menu. If this file is present, it is used instead of
|
||||||
the home or system\-wide applications menu.
|
the home or system\-wide applications menu.
|
||||||
.PP
|
.PP
|
||||||
To change default home directory of MC, you can use
|
To change default root directory of MC, you can use
|
||||||
.BR MC_HOME
|
.BR MC_HOME
|
||||||
environment variable. The value of MC_HOME must be an absolute path. If MC_HOME
|
environment variable. The value of MC_HOME must be an absolute path. If MC_HOME
|
||||||
variable is unset or empty, HOME variable is used. If HOME variable is unset
|
is unset or empty, HOME variable is used. If HOME is unset or empty, MC
|
||||||
or empty, MC home directory is get from GLib library.
|
directories are get from GLib library.
|
||||||
.\"SKIP_SECTION"
|
.\"SKIP_SECTION"
|
||||||
.SH "LICENSE"
|
.SH "LICENSE"
|
||||||
This program is distributed under the terms of the GNU General Public
|
This program is distributed under the terms of the GNU General Public
|
||||||
|
@ -2937,8 +2937,8 @@ jest używany zamiast pliku w katalogu domowym i ogólnosystemowego.
|
|||||||
To change default home directory of MC, you can use
|
To change default home directory of MC, you can use
|
||||||
.BR MC_HOME
|
.BR MC_HOME
|
||||||
environment variable. The value of MC_HOME must be an absolute path. If MC_HOME
|
environment variable. The value of MC_HOME must be an absolute path. If MC_HOME
|
||||||
variable is unset or empty, HOME variable is used. If HOME variable is unset
|
is unset or empty, HOME variable is used. If HOME is unset or empty, MC
|
||||||
or empty, MC home directory is get from GLib library.
|
directories are get from GLib library.
|
||||||
.\"SKIP_SECTION"
|
.\"SKIP_SECTION"
|
||||||
.SH LICENCJA
|
.SH LICENCJA
|
||||||
Program jest dystrybuowany na zasadach licencji GNU General Public License
|
Program jest dystrybuowany na zasadach licencji GNU General Public License
|
||||||
|
@ -4557,12 +4557,12 @@ Commander; используется только в тех случаях, ко
|
|||||||
используется вместо файла меню из домашнего каталога пользователя и
|
используется вместо файла меню из домашнего каталога пользователя и
|
||||||
общесистемного меню.
|
общесистемного меню.
|
||||||
.PP
|
.PP
|
||||||
Для того, чтобы изменить домашний каталог MC, установленный по умолчанию,
|
Для того, чтобы изменить корневой каталог MC, установленный по умолчанию,
|
||||||
можно использовать переменную окружения
|
можно использовать переменную окружения
|
||||||
.BR MC_HOME .
|
.BR MC_HOME .
|
||||||
Значением этой переменный должен быть абсолютный путь. Если переменная MC_HOME
|
Значением этой переменный должен быть абсолютный путь. Если переменная MC_HOME
|
||||||
не определена или пуста, используется переменная окружения HOME. Если и HOME
|
не определена или пуста, используется переменная окружения HOME. Если и HOME
|
||||||
не определена или пуста, домашний каталог MC определяется средствами библиотеки GLib.
|
не определена или пуста, каталоги MC определяются средствами библиотеки GLib.
|
||||||
.\"SKIP_SECTION"
|
.\"SKIP_SECTION"
|
||||||
.\" "LICENSE"
|
.\" "LICENSE"
|
||||||
.SH Лицензия
|
.SH Лицензия
|
||||||
|
@ -52,6 +52,8 @@ static char *mc_cache_str = NULL;
|
|||||||
static char *mc_data_str = NULL;
|
static char *mc_data_str = NULL;
|
||||||
|
|
||||||
static const char *homedir = NULL;
|
static const char *homedir = NULL;
|
||||||
|
/* value of $MC_HOME */
|
||||||
|
static const char *mc_home = NULL;
|
||||||
|
|
||||||
static gboolean config_dir_present = FALSE;
|
static gboolean config_dir_present = FALSE;
|
||||||
|
|
||||||
@ -276,18 +278,56 @@ mc_config_init_config_paths (GError ** error)
|
|||||||
if (xdg_vars_initialized)
|
if (xdg_vars_initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* init mc_home and homedir if not yet */
|
||||||
|
(void) mc_config_get_home_dir ();
|
||||||
|
|
||||||
#ifdef MC_HOMEDIR_XDG
|
#ifdef MC_HOMEDIR_XDG
|
||||||
dir = g_build_filename (mc_config_get_home_dir (), ".config", (char *) NULL);
|
if (mc_home != NULL)
|
||||||
mc_config_str = mc_config_init_one_config_path (dir, MC_USERCONF_DIR, error);
|
{
|
||||||
g_free (dir);
|
dir = g_build_filename (mc_home, ".config", (char *) NULL);
|
||||||
|
mc_config_str = mc_config_init_one_config_path (dir, MC_USERCONF_DIR, error);
|
||||||
|
g_free (dir);
|
||||||
|
|
||||||
dir = g_build_filename (mc_config_get_home_dir (), ".cache", (char *) NULL);
|
dir = g_build_filename (mc_home, ".cache", (char *) NULL);
|
||||||
mc_cache_str = mc_config_init_one_config_path (dir, MC_USERCONF_DIR, error);
|
mc_cache_str = mc_config_init_one_config_path (dir, MC_USERCONF_DIR, error);
|
||||||
g_free (dir);
|
g_free (dir);
|
||||||
|
|
||||||
dir = g_build_filename (mc_config_get_home_dir (), ".local", "share", (char *) NULL);
|
dir = g_build_filename (mc_home, ".local", "share", (char *) NULL);
|
||||||
mc_data_str = mc_config_init_one_config_path (dir, MC_USERCONF_DIR, error);
|
mc_data_str = mc_config_init_one_config_path (dir, MC_USERCONF_DIR, error);
|
||||||
g_free (dir);
|
g_free (dir);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dir = (char *) g_get_user_config_dir ();
|
||||||
|
if (dir != NULL && *dir != '\0')
|
||||||
|
mc_config_str = mc_config_init_one_config_path (dir, MC_USERCONF_DIR, error);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dir = g_build_filename (homedir, ".config", (char *) NULL);
|
||||||
|
mc_config_str = mc_config_init_one_config_path (dir, MC_USERCONF_DIR, error);
|
||||||
|
g_free (dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
dir = (char *) g_get_user_cache_dir ();
|
||||||
|
if (dir != NULL && *dir != '\0')
|
||||||
|
mc_cache_str = mc_config_init_one_config_path (dir, MC_USERCONF_DIR, error);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dir = g_build_filename (homedir, ".cache", (char *) NULL);
|
||||||
|
mc_cache_str = mc_config_init_one_config_path (dir, MC_USERCONF_DIR, error);
|
||||||
|
g_free (dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
dir = (char *) g_get_user_data_dir ();
|
||||||
|
if (dir != NULL && *dir != '\0')
|
||||||
|
mc_data_str = mc_config_init_one_config_path (dir, MC_USERCONF_DIR, error);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dir = g_build_filename (homedir, ".local", "share", (char *) NULL);
|
||||||
|
mc_data_str = mc_config_init_one_config_path (dir, MC_USERCONF_DIR, error);
|
||||||
|
g_free (dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mc_config_fix_migrated_rules ();
|
mc_config_fix_migrated_rules ();
|
||||||
#else /* MC_HOMEDIR_XDG */
|
#else /* MC_HOMEDIR_XDG */
|
||||||
@ -302,8 +342,7 @@ mc_config_init_config_paths (GError ** error)
|
|||||||
dir = g_build_filename (mc_config_get_home_dir (), MC_USERCONF_DIR, (char *) NULL);
|
dir = g_build_filename (mc_config_get_home_dir (), MC_USERCONF_DIR, (char *) NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
mc_data_str = mc_cache_str = mc_config_str =
|
mc_data_str = mc_cache_str = mc_config_str = mc_config_init_one_config_path (dir, "", error);
|
||||||
mc_config_init_one_config_path (dir, "", error);
|
|
||||||
|
|
||||||
g_free (dir);
|
g_free (dir);
|
||||||
#endif /* MC_HOMEDIR_XDG */
|
#endif /* MC_HOMEDIR_XDG */
|
||||||
@ -363,6 +402,8 @@ mc_config_get_home_dir (void)
|
|||||||
homedir = g_getenv ("MC_HOME");
|
homedir = g_getenv ("MC_HOME");
|
||||||
if (homedir == NULL || *homedir == '\0')
|
if (homedir == NULL || *homedir == '\0')
|
||||||
homedir = g_getenv ("HOME");
|
homedir = g_getenv ("HOME");
|
||||||
|
else
|
||||||
|
mc_home = homedir;
|
||||||
if (homedir == NULL || *homedir == '\0')
|
if (homedir == NULL || *homedir == '\0')
|
||||||
homedir = g_get_home_dir ();
|
homedir = g_get_home_dir ();
|
||||||
}
|
}
|
||||||
@ -499,7 +540,7 @@ mc_config_get_full_vpath (const char *config_name)
|
|||||||
|
|
||||||
str_path = mc_config_get_full_path (config_name);
|
str_path = mc_config_get_full_path (config_name);
|
||||||
|
|
||||||
ret_vpath = vfs_path_from_str(str_path);
|
ret_vpath = vfs_path_from_str (str_path);
|
||||||
g_free (str_path);
|
g_free (str_path);
|
||||||
return ret_vpath;
|
return ret_vpath;
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ show_version (void)
|
|||||||
void
|
void
|
||||||
show_datadirs_extended (void)
|
show_datadirs_extended (void)
|
||||||
{
|
{
|
||||||
(void) printf ("%s %s\n", _("Home directory:"), mc_config_get_home_dir ());
|
(void) printf ("%s %s\n", _("Root directory:"), mc_config_get_home_dir ());
|
||||||
(void) puts ("");
|
(void) puts ("");
|
||||||
|
|
||||||
PRINTF_GROUP (_("System data"));
|
PRINTF_GROUP (_("System data"));
|
||||||
|
Loading…
Reference in New Issue
Block a user