1
1

Load locale-specific info (help and hints) from /usr/share/mc only.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
Andrew Borodin 2010-09-16 14:11:48 +04:00
родитель bfbac0c5d8
Коммит 9636ca2583
2 изменённых файлов: 11 добавлений и 23 удалений

Просмотреть файл

@ -628,43 +628,32 @@ 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)
{ {
/* Fall back to the two-letter language code */
if (lang[0] != '\0' && lang[1] != '\0')
lang[2] = '\0';
g_free (hintfile); 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); hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL);
data = load_file (hintfile); data = load_file (hintfile);
if (!data) if (data == NULL)
{ {
/* Fall back to the two-letter language code */
if (lang[0] && lang[1])
lang[2] = 0;
g_free (hintfile); g_free (hintfile);
hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL); hintfile = hintfile_base;
data = load_file (hintfile); data = load_file (hintfile_base);
if (!data)
{
g_free (hintfile);
hintfile = hintfile_base;
data = load_file (hintfile_base);
}
} }
} }
@ -673,7 +662,7 @@ load_mc_home_file (const char *_mc_home, const char *_mc_home_alt, const char *f
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);