mc/mc-mkdir_mc_home.patch

38 lines
1006 B
Diff
Raw Normal View History

--- src/main.c 2009-10-10 22:21:47.000000000 +0200
+++ src/main.c 2009-10-11 12:05:35.000000000 +0200
@@ -62,6 +62,7 @@
#include "listmode.h"
#include "execute.h"
#include "ext.h" /* For flush_extension_file() */
+#include "fileloc.h"
/* Listbox for the command history feature */
#include "widget.h"
@@ -2129,8 +2130,10 @@
int
main (int argc, char *argv[])
{
+ struct stat s;
/* Check whether we have UTF-8 locale */
char *lang = getenv("LANG");
+ char *mc_dir;
size_t len = 0;
if ( lang )
@@ -2201,6 +2204,15 @@
init_xterm_support ();
+ /* create home directory */
+ mc_dir = mhl_str_dir_plus_file (home_dir, MC_USERCONF_DIR);
+ canonicalize_pathname (mc_dir);
+ if ((stat (mc_dir, &s) != 0) && (errno == ENOENT) && mkdir (mc_dir, 0700) != 0)
+ message (D_ERROR, _("Warning"),
+ _("Cannot create %s directory"), mc_dir);
+ g_free (mc_dir);
+
+
#ifdef HAVE_SUBSHELL_SUPPORT
/* Done here to ensure that the subshell doesn't */