Load locale-specific info (help and hints) from /usr/share/mc only.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
bfbac0c5d8
Коммит
9636ca2583
25
lib/util.c
25
lib/util.c
@ -628,52 +628,41 @@ load_file (const char *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
load_mc_home_file (const char *_mc_home, const char *_mc_home_alt, const char *filename,
|
load_mc_home_file (const char *from, const char *filename, char **allocated_filename)
|
||||||
char **allocated_filename)
|
|
||||||
{
|
{
|
||||||
char *hintfile_base, *hintfile;
|
char *hintfile_base, *hintfile;
|
||||||
char *lang;
|
char *lang;
|
||||||
char *data;
|
char *data;
|
||||||
|
|
||||||
hintfile_base = concat_dir_and_file (_mc_home, filename);
|
hintfile_base = g_build_filename (from, filename, (char *) NULL);
|
||||||
lang = guess_message_value ();
|
lang = guess_message_value ();
|
||||||
|
|
||||||
hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL);
|
hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL);
|
||||||
data = load_file (hintfile);
|
data = load_file (hintfile);
|
||||||
|
|
||||||
if (!data)
|
if (data == NULL)
|
||||||
{
|
|
||||||
g_free (hintfile);
|
|
||||||
g_free (hintfile_base);
|
|
||||||
hintfile_base = concat_dir_and_file (_mc_home_alt, filename);
|
|
||||||
|
|
||||||
hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL);
|
|
||||||
data = load_file (hintfile);
|
|
||||||
|
|
||||||
if (!data)
|
|
||||||
{
|
{
|
||||||
/* Fall back to the two-letter language code */
|
/* Fall back to the two-letter language code */
|
||||||
if (lang[0] && lang[1])
|
if (lang[0] != '\0' && lang[1] != '\0')
|
||||||
lang[2] = 0;
|
lang[2] = '\0';
|
||||||
g_free (hintfile);
|
g_free (hintfile);
|
||||||
hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL);
|
hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL);
|
||||||
data = load_file (hintfile);
|
data = load_file (hintfile);
|
||||||
|
|
||||||
if (!data)
|
if (data == NULL)
|
||||||
{
|
{
|
||||||
g_free (hintfile);
|
g_free (hintfile);
|
||||||
hintfile = hintfile_base;
|
hintfile = hintfile_base;
|
||||||
data = load_file (hintfile_base);
|
data = load_file (hintfile_base);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
g_free (lang);
|
g_free (lang);
|
||||||
|
|
||||||
if (hintfile != hintfile_base)
|
if (hintfile != hintfile_base)
|
||||||
g_free (hintfile_base);
|
g_free (hintfile_base);
|
||||||
|
|
||||||
if (allocated_filename)
|
if (allocated_filename != NULL)
|
||||||
*allocated_filename = hintfile;
|
*allocated_filename = hintfile;
|
||||||
else
|
else
|
||||||
g_free (hintfile);
|
g_free (hintfile);
|
||||||
|
@ -100,8 +100,7 @@ char *diff_two_paths (const char *first, const char *second);
|
|||||||
const char *x_basename (const char *fname);
|
const char *x_basename (const char *fname);
|
||||||
|
|
||||||
char *load_file (const char *filename);
|
char *load_file (const char *filename);
|
||||||
char *load_mc_home_file (const char *, const char *, const char *filename,
|
char *load_mc_home_file (const char *from, const char *filename, char **allocated_filename);
|
||||||
char **allocated_filename);
|
|
||||||
|
|
||||||
/* uid/gid managing */
|
/* uid/gid managing */
|
||||||
void init_groups (void);
|
void init_groups (void);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user