This allows to reduce conditionnal compilation complexity.
Based on work done by Mathieu Albinet for windows port
Guilhem Bonnefille <guilhem.bonnefille@gmail.com>:
Mathieu Albinet <mathieu17@gmail.com>:
* Portability: reduce unistd.h dependency
+ * Portability: replace mkdir by g_mkdir
2008-03-27:
Mathieu Albinet <mathieu17@gmail.com>:
# Checks for library functions.
AC_FUNC_STAT
AC_FUNC_STRTOD
-AC_CHECK_FUNCS([bzero floor gethostbyname memset mkdir mkdtemp pow realpath socket sqrt strcasecmp strchr strdup strncasecmp strtol strtoul])
+AC_CHECK_FUNCS([bzero floor gethostbyname memset mkdtemp pow realpath socket sqrt strcasecmp strchr strdup strncasecmp strtol strtoul])
# Expat
AM_WITH_EXPAT
#include <string.h>
#include <strings.h>
#include <gtk/gtk.h>
-#include <sys/stat.h>
-#include <sys/types.h>
+#include <glib.h>
+#include <glib/gstdio.h>
#include <glib/gi18n.h>
#include "download.h"
#else
-#include <sys/types.h>
/* dirname */
#include <libgen.h>
if ( errno == ENOENT)
{
char *tmp = g_strdup ( fn );
-#ifdef WINDOWS
- mkdir( dirname ( dirname ( tmp ) ) );
- g_free ( tmp ); tmp = g_strdup ( fn );
- mkdir( dirname ( tmp ) );
-#else
- mkdir( dirname ( dirname ( tmp ) ), 0777 );
+ g_mkdir( dirname ( dirname ( tmp ) ), 0777 );
g_free ( tmp ); tmp = g_strdup ( fn );
- mkdir( dirname ( tmp ), 0777 );
-#endif
+ g_mkdir( dirname ( tmp ), 0777 );
g_free ( tmp );
}
/* create placeholder file */
#include <stdio.h>
#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
#include <errno.h>
#include <curl/curl.h>
#endif
#include <stdlib.h>
-#include <sys/stat.h>
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
#include <string.h>
+#include <glib.h>
+#include <glib/gstdio.h>
#include "viking.h"
#include "thumbnails.h"
#include "thumbnails_pixbuf.h"
#define HOME_DIR "C:\\VIKING"
#define THUMB_DIR "\\THUMBNAILS\\" /* viking maps default viking\maps */
#define THUMB_SUB_DIR "normal\\"
-#define mkdir(a,b) mkdir(a)
#define realpath(X,Y) _fullpath(Y,X,MAX_PATH)
#else
to = g_string_new(HOME_DIR);
#ifndef WINDOWS
- mkdir(to->str, 0700);
+ g_mkdir(to->str, 0700);
#endif
g_string_append(to, THUMB_DIR);
- mkdir(to->str, 0700);
+ g_mkdir(to->str, 0700);
g_string_append(to, THUMB_SUB_DIR);
- mkdir(to->str, 0700);
+ g_mkdir(to->str, 0700);
g_string_append(to, md5);
name_len = to->len + 4; /* Truncate to this length when renaming */
#ifdef WINDOWS
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <sys/stat.h>
-#include <sys/types.h>
#include "mapcache.h"
/* only for dialog.h -- ugh */
{
if ( vml->cache_dir && strcmp ( vml->cache_dir, MAPS_CACHE_DIR ) == 0 && g_file_test ( vml->cache_dir, G_FILE_TEST_EXISTS ) == FALSE )
{
-#ifdef WINDOWS
- mkdir ( vml->cache_dir );
-#else
- mkdir ( vml->cache_dir, 0777 );
-#endif
+ g_mkdir ( vml->cache_dir, 0777 );
}
}
#include <math.h>
#include <string.h>
#include <ctype.h>
+#include <glib.h>
+#include <glib/gstdio.h>
#include <glib/gprintf.h>
#include <glib/gi18n.h>
-#ifdef WINDOWS
-/* TODO IMPORTANT: mkdir for windows header? is it called 'mkdir' */
-#define make_dir(dir) mkdir(dir)
-#else
-#include <sys/types.h>
-#include <sys/stat.h>
-#define make_dir(dir) mkdir(dir,0777)
-#endif
#define VIKING_WINDOW_WIDTH 1000
#define VIKING_WINDOW_HEIGHT 800
g_assert ( vik_viewport_get_coord_mode ( vw->viking_vvp ) == VIK_COORD_UTM );
- make_dir(fn);
+ g_mkdir(fn,0777);
utm_orig = *((const struct UTM *)vik_viewport_get_center ( vw->viking_vvp ));