Changeset: 012ed85b03ab for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=012ed85b03ab
Modified Files:
common/utils/mutils.c
common/utils/mutils.h
monetdb5/mal/mal_linker.mx
Branch: default
Log Message:
Implemented get_mserver_bin_path() on Windows.
diffs (63 lines):
diff --git a/common/utils/mutils.c b/common/utils/mutils.c
--- a/common/utils/mutils.c
+++ b/common/utils/mutils.c
@@ -152,6 +152,20 @@
return 0;
}
+char *
+dirname(char *path)
+{
+ char *p, *q;
+
+ for (p = path, q = NULL; *p; p++)
+ if (*p == '/' || *p == '\\')
+ q = p;
+ if (q == NULL)
+ return ".";
+ *q = '\0';
+ return path;
+}
+
/* see contract of unix MT_lockf */
int
MT_lockf(char *filename, int mode, off_t off, off_t len)
diff --git a/common/utils/mutils.h b/common/utils/mutils.h
--- a/common/utils/mutils.h
+++ b/common/utils/mutils.h
@@ -50,6 +50,8 @@
mutils_export void rewinddir(DIR *dir);
mutils_export int closedir(DIR *dir);
+mutils_export char *dirname(char *path);
+
#endif
#ifndef S_IRUSR
diff --git a/monetdb5/mal/mal_linker.mx b/monetdb5/mal/mal_linker.mx
--- a/monetdb5/mal/mal_linker.mx
+++ b/monetdb5/mal/mal_linker.mx
@@ -107,7 +107,9 @@
#include <sys/stat.h>
#endif
#include <unistd.h>
+#ifdef HAVE_LIBGEN_H
#include <libgen.h>
+#endif
#if defined(_MSC_VER) && _MSC_VER >= 1400
#define open _open
@@ -356,7 +358,12 @@
{
/* getting the path to the executable's binary, isn't all that
* simple, unfortunately */
-#if defined(HAVE__NSGETEXECUTABLEPATH) /* Darwin/OSX */
+#if defined(_MSC_VER) /* Windows */
+ DWORD buflen = (DWORD) sizeof(_mserver_bin_path);
+ if (QueryFullProcessImageName(GetCurrentProcess(), 0,
+ _mserver_bin_path, &buflen) != 0)
+ return _mserver_bin_path;
+#elif defined(HAVE__NSGETEXECUTABLEPATH) /* Darwin/OSX */
uint32_t size = sizeof(_mserver_bin_path);
if (_NSGetExecutablePath(_mserver_bin_path, &size) == 0)
return _mserver_bin_path;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list