MSVC compatiblity: open() flags and S_ISDIR doesn't exist on MSVC.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18753 57a11ea4-9604-0410-9ed3-97b8803252fd
pull/1/head
Christian Stimming 16 years ago
parent ea5fb548c5
commit 1383ccae9e

@ -241,7 +241,11 @@ xml_session_begin(QofBackend *be_start, QofSession *session,
/* Again check whether the directory can be accessed */
rc = g_stat (be->dirname, &statbuf);
if (rc != 0 || !S_ISDIR(statbuf.st_mode))
if (rc != 0
#ifndef _MSC_VER
|| !S_ISDIR(statbuf.st_mode)
#endif
)
{
/* Error on stat or if it isn't a directory means we
cannot find this filename */
@ -267,7 +271,11 @@ xml_session_begin(QofBackend *be_start, QofSession *session,
LEAVE("");
return;
}
if (rc == 0 && S_ISDIR(statbuf.st_mode))
if (rc == 0
#ifndef _MSC_VER
&& S_ISDIR(statbuf.st_mode)
#endif
)
{
/* FIXME: What is actually checked here? Whether the
fullpath erroneously points to a directory or what?

@ -369,7 +369,13 @@ gnc_validate_directory (const gchar *dirname)
if (rc) {
switch (errno) {
case ENOENT:
rc = g_mkdir (dirname, S_IRWXU); /* perms = S_IRWXU = 0700 */
rc = g_mkdir (dirname,
#ifdef G_OS_WIN32
0 /* The mode argument is ignored on windows */
#else
S_IRWXU /* perms = S_IRWXU = 0700 */
#endif
);
if (rc) {
g_fprintf(stderr,
_("An error occurred while creating the directory:\n"
@ -422,6 +428,8 @@ gnc_validate_directory (const gchar *dirname)
dirname);
exit(1);
}
#ifndef G_OS_WIN32
/* The mode argument is ignored on windows anyway */
if ((statbuf.st_mode & S_IRWXU) != S_IRWXU) {
g_fprintf(stderr,
_("The permissions are wrong on the directory\n"
@ -430,6 +438,7 @@ gnc_validate_directory (const gchar *dirname)
dirname);
exit(1);
}
#endif
}
const gchar *

Loading…
Cancel
Save