mirror of https://github.com/djcb/mu.git
* mu-runtime, mu-util: improve check for muhome dir
This commit is contained in:
parent
091dedf954
commit
49077bf7d1
|
@ -52,10 +52,10 @@ static void runtime_free (void);
|
||||||
static gboolean
|
static gboolean
|
||||||
mu_dir_is_readable_and_writable (const char* muhome)
|
mu_dir_is_readable_and_writable (const char* muhome)
|
||||||
{
|
{
|
||||||
if (mu_util_check_dir(muhome, TRUE, TRUE))
|
if (mu_util_create_dir_maybe (muhome))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
g_warning ("'%s' is not a read/writable directory", muhome);
|
g_warning ("cannot use '%s' as a mu homedir", muhome);
|
||||||
g_warning ("use --muhome= to set a different one");
|
g_warning ("use --muhome= to set a different one");
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/*
|
/*
|
||||||
|
**
|
||||||
** Copyright (C) 2008-2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
** Copyright (C) 2008-2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||||
**
|
**
|
||||||
** This program is free software; you can redistribute it and/or modify
|
** This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -207,10 +208,10 @@ mu_util_create_dir_maybe (const gchar *path)
|
||||||
if (stat (path, &statbuf) == 0) {
|
if (stat (path, &statbuf) == 0) {
|
||||||
if ((!S_ISDIR(statbuf.st_mode)) ||
|
if ((!S_ISDIR(statbuf.st_mode)) ||
|
||||||
(access (path, W_OK|R_OK) != 0)) {
|
(access (path, W_OK|R_OK) != 0)) {
|
||||||
g_warning ("not a rw-directory: %s", path);
|
g_warning ("not a read-writable directory: %s", path);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_mkdir_with_parents (path, 0700) != 0) {
|
if (g_mkdir_with_parents (path, 0700) != 0) {
|
||||||
g_warning ("failed to create %s: %s",
|
g_warning ("failed to create %s: %s",
|
||||||
|
|
Loading…
Reference in New Issue