X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-conf.c;h=02cc2751212a2a0de931fe7a2b9e722b342255e2;hb=43b96ca660fb4c57674f1625aad48b83c0170de0;hp=07db3b58c21e5d07e16d8789a285f2ad20978450;hpb=f550aee00a62fe1d8baf62d83cd7efef6cc2ee92;p=pspp diff --git a/src/ui/gui/psppire-conf.c b/src/ui/gui/psppire-conf.c index 07db3b58c2..02cc275121 100644 --- a/src/ui/gui/psppire-conf.c +++ b/src/ui/gui/psppire-conf.c @@ -20,7 +20,9 @@ */ #include +#include #include +#include #include "psppire-conf.h" @@ -140,7 +142,15 @@ psppire_conf_class_init (PsppireConfClass *class) static void psppire_conf_init (PsppireConf *conf) { - const gchar *dirname = g_get_user_config_dir (); + const gchar *dirname; + struct stat s; + + /* Get the name of the directory for user configuration files, then, if it + doesn't already exist, create it, since we might be the first program + to want to put files there. */ + dirname = g_get_user_config_dir (); + if (stat (dirname, &s) == -1 && errno == ENOENT) + mkdir (dirname, 0700); conf->filename = g_strdup_printf ("%s/%s", dirname, "psppirerc");