+2001-03-01 Tor Lillqvist <tml@iki.fi>
+
+ * gutils.c (g_path_is_absolute): (Win32) Remove test for initial
+ double backslash (UNC path), this will of course be matched by the
+ test for an initial G_DIR_SEPARATOR right up front. Silly me.
+ (g_find_program_in_path): Implement on Win32.
+ (g_get_any_init): (Win32) Also look for the USERPROFILE env var
+ indicating the home directory equivalent.
+
+ * testglib.c (main): Test g_find_program_in_path() on Win32 by
+ looking for more.com and regedit.exe.
+
+ * glib.def: Add g_find_program_in_path.
+
2001-02-26 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gthreadpool.c (g_thread_pool_thread_proxy): Make
+2001-03-01 Tor Lillqvist <tml@iki.fi>
+
+ * gutils.c (g_path_is_absolute): (Win32) Remove test for initial
+ double backslash (UNC path), this will of course be matched by the
+ test for an initial G_DIR_SEPARATOR right up front. Silly me.
+ (g_find_program_in_path): Implement on Win32.
+ (g_get_any_init): (Win32) Also look for the USERPROFILE env var
+ indicating the home directory equivalent.
+
+ * testglib.c (main): Test g_find_program_in_path() on Win32 by
+ looking for more.com and regedit.exe.
+
+ * glib.def: Add g_find_program_in_path.
+
2001-02-26 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gthreadpool.c (g_thread_pool_thread_proxy): Make
+2001-03-01 Tor Lillqvist <tml@iki.fi>
+
+ * gutils.c (g_path_is_absolute): (Win32) Remove test for initial
+ double backslash (UNC path), this will of course be matched by the
+ test for an initial G_DIR_SEPARATOR right up front. Silly me.
+ (g_find_program_in_path): Implement on Win32.
+ (g_get_any_init): (Win32) Also look for the USERPROFILE env var
+ indicating the home directory equivalent.
+
+ * testglib.c (main): Test g_find_program_in_path() on Win32 by
+ looking for more.com and regedit.exe.
+
+ * glib.def: Add g_find_program_in_path.
+
2001-02-26 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gthreadpool.c (g_thread_pool_thread_proxy): Make
+2001-03-01 Tor Lillqvist <tml@iki.fi>
+
+ * gutils.c (g_path_is_absolute): (Win32) Remove test for initial
+ double backslash (UNC path), this will of course be matched by the
+ test for an initial G_DIR_SEPARATOR right up front. Silly me.
+ (g_find_program_in_path): Implement on Win32.
+ (g_get_any_init): (Win32) Also look for the USERPROFILE env var
+ indicating the home directory equivalent.
+
+ * testglib.c (main): Test g_find_program_in_path() on Win32 by
+ looking for more.com and regedit.exe.
+
+ * glib.def: Add g_find_program_in_path.
+
2001-02-26 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gthreadpool.c (g_thread_pool_thread_proxy): Make
+2001-03-01 Tor Lillqvist <tml@iki.fi>
+
+ * gutils.c (g_path_is_absolute): (Win32) Remove test for initial
+ double backslash (UNC path), this will of course be matched by the
+ test for an initial G_DIR_SEPARATOR right up front. Silly me.
+ (g_find_program_in_path): Implement on Win32.
+ (g_get_any_init): (Win32) Also look for the USERPROFILE env var
+ indicating the home directory equivalent.
+
+ * testglib.c (main): Test g_find_program_in_path() on Win32 by
+ looking for more.com and regedit.exe.
+
+ * glib.def: Add g_find_program_in_path.
+
2001-02-26 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gthreadpool.c (g_thread_pool_thread_proxy): Make
+2001-03-01 Tor Lillqvist <tml@iki.fi>
+
+ * gutils.c (g_path_is_absolute): (Win32) Remove test for initial
+ double backslash (UNC path), this will of course be matched by the
+ test for an initial G_DIR_SEPARATOR right up front. Silly me.
+ (g_find_program_in_path): Implement on Win32.
+ (g_get_any_init): (Win32) Also look for the USERPROFILE env var
+ indicating the home directory equivalent.
+
+ * testglib.c (main): Test g_find_program_in_path() on Win32 by
+ looking for more.com and regedit.exe.
+
+ * glib.def: Add g_find_program_in_path.
+
2001-02-26 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gthreadpool.c (g_thread_pool_thread_proxy): Make
+2001-03-01 Tor Lillqvist <tml@iki.fi>
+
+ * gutils.c (g_path_is_absolute): (Win32) Remove test for initial
+ double backslash (UNC path), this will of course be matched by the
+ test for an initial G_DIR_SEPARATOR right up front. Silly me.
+ (g_find_program_in_path): Implement on Win32.
+ (g_get_any_init): (Win32) Also look for the USERPROFILE env var
+ indicating the home directory equivalent.
+
+ * testglib.c (main): Test g_find_program_in_path() on Win32 by
+ looking for more.com and regedit.exe.
+
+ * glib.def: Add g_find_program_in_path.
+
2001-02-26 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gthreadpool.c (g_thread_pool_thread_proxy): Make
+2001-03-01 Tor Lillqvist <tml@iki.fi>
+
+ * gutils.c (g_path_is_absolute): (Win32) Remove test for initial
+ double backslash (UNC path), this will of course be matched by the
+ test for an initial G_DIR_SEPARATOR right up front. Silly me.
+ (g_find_program_in_path): Implement on Win32.
+ (g_get_any_init): (Win32) Also look for the USERPROFILE env var
+ indicating the home directory equivalent.
+
+ * testglib.c (main): Test g_find_program_in_path() on Win32 by
+ looking for more.com and regedit.exe.
+
+ * glib.def: Add g_find_program_in_path.
+
2001-02-26 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gthreadpool.c (g_thread_pool_thread_proxy): Make
(This flag means that the struct layout is identical to that used by
MSVC.)
-To test the GLib functions, go to the tests subdirectory and enter
-`nmake -f makefile.msc check` or `make -f makefile.mingw check`.
-
If you would want to use the cygwin tools to generate executables that
*do* use the cygwin runtime, the normal Unix configuration method
should work as if on Unix. But it won't produce DLLs. At least I
g_file_test
g_filename_from_utf8
g_filename_to_utf8
+ g_find_program_in_path
g_free
g_get_charset
g_get_codeset
g_file_test
g_filename_from_utf8
g_filename_to_utf8
+ g_find_program_in_path
g_free
g_get_charset
g_get_codeset
#ifdef G_OS_WIN32
# define STRICT /* Strict typing, please */
# include <windows.h>
+# undef STRICT
# include <ctype.h>
# include <direct.h>
#endif /* G_OS_WIN32 */
{
const gchar *path, *p;
gchar *name, *freeme;
+#ifdef G_OS_WIN32
+ gchar *path_tmp;
+#endif
size_t len;
size_t pathlen;
+ /* On Win32, should we try appending .exe, .com, and the other
+ * components of %PATHEXT% ?
+ */
+
g_return_val_if_fail (program != NULL, NULL);
- if (*program == '/')
+ if (g_path_is_absolute (program))
{
if (g_file_test (program, G_FILE_TEST_IS_EXECUTABLE))
return g_strdup (program);
}
path = g_getenv ("PATH");
+#ifdef G_OS_UNIX
if (path == NULL)
{
/* There is no `PATH' in the environment. The default
path = "/bin:/usr/bin:.";
}
+#else
+ {
+ gchar *tmp;
+ gchar moddir[PATH_MAX], sysdir[PATH_MAX], windir[PATH_MAX];
+
+ GetModuleFileName (NULL, moddir, sizeof (moddir));
+ tmp = g_path_get_dirname (moddir);
+ GetSystemDirectory (sysdir, sizeof (sysdir));
+ GetWindowsDirectory (windir, sizeof (windir));
+ path_tmp = g_strconcat (tmp, ";.;", sysdir, ";", windir,
+ (path != NULL ? ";" : NULL),
+ (path != NULL ? path : NULL),
+ NULL);
+ g_free (tmp);
+ path = path_tmp;
+ }
+#endif
len = strlen (program) + 1;
pathlen = strlen (path);
memcpy (name + pathlen + 1, program, len);
name = name + pathlen;
/* And add the slash before the filename */
- *name = '/';
+ *name = G_DIR_SEPARATOR;
p = path;
do
char *startp;
path = p;
- p = my_strchrnul (path, ':');
+ p = my_strchrnul (path, G_SEARCHPATH_SEPARATOR);
if (p == path)
/* Two adjacent colons, or a colon at the beginning or the end
gchar *ret;
ret = g_strdup (startp);
g_free (freeme);
+#ifdef G_OS_WIN32
+ g_free (path_tmp);
+#endif
return ret;
}
}
while (*p++ != '\0');
g_free (freeme);
+#ifdef G_OS_WIN32
+ g_free (path_tmp);
+#endif
return NULL;
}
#ifdef G_OS_WIN32
if (isalpha (file_name[0]) && file_name[1] == ':' && file_name[2] == G_DIR_SEPARATOR)
return TRUE;
-
- if (file_name[0] == G_DIR_SEPARATOR && file_name[1] == G_DIR_SEPARATOR)
- return TRUE;
#endif
return FALSE;
{
/* USERPROFILE is probably the closest equivalent to $HOME? */
if (getenv ("USERPROFILE") != NULL)
- g_home_dir = g_getenv ("USERPROFILE");
+ g_home_dir = g_strdup (g_getenv ("USERPROFILE"));
}
if (!g_home_dir)
## Makefile for building the GLib dlls with Microsoft C
## Use: nmake -f makefile.msc
-# Change this to wherever you want to install the DLLs. This directory
-# should be in your PATH.
-BIN = C:\bin
-
TOP = ..
!INCLUDE build\win32\make.msc
DEPCFLAGS = $(INTL_CFLAGS) $(LIBICONV_CFLAGS)
DLLS_TO_BUILD = \
- glib-$(GLIB_VER).dll \
+ glib-$(GLIB_VER).dll \
sub-gmodule \
sub-gthread \
sub-gobject
testgdate.exe \
testgdateparser.exe
-install : all
- copy glib-$(GLIB_VER).dll $(BIN)
-
glib_OBJECTS = \
garray.obj \
gasyncqueue.obj \
#ifdef G_OS_WIN32
# define STRICT /* Strict typing, please */
# include <windows.h>
+# undef STRICT
# include <ctype.h>
# include <direct.h>
#endif /* G_OS_WIN32 */
{
const gchar *path, *p;
gchar *name, *freeme;
+#ifdef G_OS_WIN32
+ gchar *path_tmp;
+#endif
size_t len;
size_t pathlen;
+ /* On Win32, should we try appending .exe, .com, and the other
+ * components of %PATHEXT% ?
+ */
+
g_return_val_if_fail (program != NULL, NULL);
- if (*program == '/')
+ if (g_path_is_absolute (program))
{
if (g_file_test (program, G_FILE_TEST_IS_EXECUTABLE))
return g_strdup (program);
}
path = g_getenv ("PATH");
+#ifdef G_OS_UNIX
if (path == NULL)
{
/* There is no `PATH' in the environment. The default
path = "/bin:/usr/bin:.";
}
+#else
+ {
+ gchar *tmp;
+ gchar moddir[PATH_MAX], sysdir[PATH_MAX], windir[PATH_MAX];
+
+ GetModuleFileName (NULL, moddir, sizeof (moddir));
+ tmp = g_path_get_dirname (moddir);
+ GetSystemDirectory (sysdir, sizeof (sysdir));
+ GetWindowsDirectory (windir, sizeof (windir));
+ path_tmp = g_strconcat (tmp, ";.;", sysdir, ";", windir,
+ (path != NULL ? ";" : NULL),
+ (path != NULL ? path : NULL),
+ NULL);
+ g_free (tmp);
+ path = path_tmp;
+ }
+#endif
len = strlen (program) + 1;
pathlen = strlen (path);
memcpy (name + pathlen + 1, program, len);
name = name + pathlen;
/* And add the slash before the filename */
- *name = '/';
+ *name = G_DIR_SEPARATOR;
p = path;
do
char *startp;
path = p;
- p = my_strchrnul (path, ':');
+ p = my_strchrnul (path, G_SEARCHPATH_SEPARATOR);
if (p == path)
/* Two adjacent colons, or a colon at the beginning or the end
gchar *ret;
ret = g_strdup (startp);
g_free (freeme);
+#ifdef G_OS_WIN32
+ g_free (path_tmp);
+#endif
return ret;
}
}
while (*p++ != '\0');
g_free (freeme);
+#ifdef G_OS_WIN32
+ g_free (path_tmp);
+#endif
return NULL;
}
#ifdef G_OS_WIN32
if (isalpha (file_name[0]) && file_name[1] == ':' && file_name[2] == G_DIR_SEPARATOR)
return TRUE;
-
- if (file_name[0] == G_DIR_SEPARATOR && file_name[1] == G_DIR_SEPARATOR)
- return TRUE;
#endif
return FALSE;
{
/* USERPROFILE is probably the closest equivalent to $HOME? */
if (getenv ("USERPROFILE") != NULL)
- g_home_dir = g_getenv ("USERPROFILE");
+ g_home_dir = g_strdup (g_getenv ("USERPROFILE"));
}
if (!g_home_dir)
## Makefile for building the GLib dlls with Microsoft C
## Use: nmake -f makefile.msc
-# Change this to wherever you want to install the DLLs. This directory
-# should be in your PATH.
-BIN = C:\bin
-
TOP = ..
!INCLUDE build\win32\make.msc
DEPCFLAGS = $(INTL_CFLAGS) $(LIBICONV_CFLAGS)
DLLS_TO_BUILD = \
- glib-$(GLIB_VER).dll \
+ glib-$(GLIB_VER).dll \
sub-gmodule \
sub-gthread \
sub-gobject
testgdate.exe \
testgdateparser.exe
-install : all
- copy glib-$(GLIB_VER).dll $(BIN)
-
glib_OBJECTS = \
garray.obj \
gasyncqueue.obj \
g_win32_get_package_installation_subdirectory (NULL, glib_dll, "locale"));
g_print ("GTK+ 2.0 installation directory, if available: %s\n",
g_win32_get_package_installation_directory ("gtk20", NULL));
+
+ g_print ("found more.com as %s\n", g_find_program_in_path ("more.com"));
+ g_print ("found regedit.exe as %s\n", g_find_program_in_path ("regedit.exe"));
+
#endif
g_print ("checking file functions...\n");
g_win32_get_package_installation_subdirectory (NULL, glib_dll, "locale"));
g_print ("GTK+ 2.0 installation directory, if available: %s\n",
g_win32_get_package_installation_directory ("gtk20", NULL));
+
+ g_print ("found more.com as %s\n", g_find_program_in_path ("more.com"));
+ g_print ("found regedit.exe as %s\n", g_find_program_in_path ("regedit.exe"));
+
#endif
g_print ("checking file functions...\n");