r18753 - gnucash/trunk/src - MSVC compatiblity: open() flags and S_ISDIR doesn't exist on MSVC.
Christian Stimming
cstim at code.gnucash.org
Sat Feb 27 13:41:07 EST 2010
Author: cstim
Date: 2010-02-27 13:41:07 -0500 (Sat, 27 Feb 2010)
New Revision: 18753
Trac: http://svn.gnucash.org/trac/changeset/18753
Modified:
gnucash/trunk/src/backend/xml/gnc-backend-xml.c
gnucash/trunk/src/engine/gnc-filepath-utils.c
Log:
MSVC compatiblity: open() flags and S_ISDIR doesn't exist on MSVC.
Modified: gnucash/trunk/src/backend/xml/gnc-backend-xml.c
===================================================================
--- gnucash/trunk/src/backend/xml/gnc-backend-xml.c 2010-02-27 18:40:46 UTC (rev 18752)
+++ gnucash/trunk/src/backend/xml/gnc-backend-xml.c 2010-02-27 18:41:07 UTC (rev 18753)
@@ -241,7 +241,11 @@
/* 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 @@
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?
Modified: gnucash/trunk/src/engine/gnc-filepath-utils.c
===================================================================
--- gnucash/trunk/src/engine/gnc-filepath-utils.c 2010-02-27 18:40:46 UTC (rev 18752)
+++ gnucash/trunk/src/engine/gnc-filepath-utils.c 2010-02-27 18:41:07 UTC (rev 18753)
@@ -369,7 +369,13 @@
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 @@
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 @@
dirname);
exit(1);
}
+#endif
}
const gchar *
More information about the gnucash-changes
mailing list