mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
src/main.c (main): create MC home directory (~/.mc) if absent.
This commit is contained in:
parent
3da14e7f8f
commit
ab1bdc1429
13
src/main.c
13
src/main.c
@ -2125,6 +2125,9 @@ handle_args (int argc, char *argv[])
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
struct stat s;
|
||||||
|
char *mc_dir;
|
||||||
|
|
||||||
/* We had LC_CTYPE before, LC_ALL includs LC_TYPE as well */
|
/* We had LC_CTYPE before, LC_ALL includs LC_TYPE as well */
|
||||||
setlocale (LC_ALL, "");
|
setlocale (LC_ALL, "");
|
||||||
bindtextdomain ("mc", LOCALEDIR);
|
bindtextdomain ("mc", LOCALEDIR);
|
||||||
@ -2192,6 +2195,16 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
init_curses ();
|
init_curses ();
|
||||||
|
|
||||||
|
/* create home directory */
|
||||||
|
/* do it after the screen library initialization to show the error message */
|
||||||
|
mc_dir = concat_dir_and_file (home_dir, MC_BASE);
|
||||||
|
canonicalize_pathname (mc_dir);
|
||||||
|
if ((stat (mc_dir, &s) != 0) && (errno == ENOENT)
|
||||||
|
&& mkdir (mc_dir, 0755) != 0)
|
||||||
|
message (D_ERROR, _("Warning"),
|
||||||
|
_("Cannot create %s directory"), mc_dir);
|
||||||
|
g_free (mc_dir);
|
||||||
|
|
||||||
init_xterm_support ();
|
init_xterm_support ();
|
||||||
|
|
||||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||||
|
Loading…
Reference in New Issue
Block a user