mc/mc-mkdir_mc_home.patch
OBS User autobuild 9b7e3734d1 Accepting request 22286 from Base:System
Copy from Base:System/mc based on submit request 22286 from user prusnak

OBS-URL: https://build.opensuse.org/request/show/22286
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mc?expand=0&rev=17
2009-10-12 18:58:02 +00:00

38 lines
1006 B
Diff

--- 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 */