Look also for (illegal) forward slashes in the template.
authorTor Lillqvist <tml@iki.fi>
Fri, 5 Jan 2001 19:30:13 +0000 (19:30 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Fri, 5 Jan 2001 19:30:13 +0000 (19:30 +0000)
2001-01-05  Tor Lillqvist  <tml@iki.fi>

* gfileutils.c (g_file_open_tmp): (Win32:) Look also for (illegal)
forward slashes in the template.

* gutils.c (g_path_skip_root): On Win32, skip the \\server\share
part of UNC paths. On all platforms, skip several initial
slashes. Add a few comments.
(g_get_any_init): On Win32, in case HOME is Unix-style with
(forward) slashes (some other applications apparently set it up
this way, convert to backslashed form.

* configure.in (glib_os): Remove stray 'v'. Add case for mingw,
although using configure for mingw surely doesn't work yet.

* glib.def: Update.

15 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
configure.in
gfileutils.c
glib.def
glib/gfileutils.c
glib/glib.def
glib/gutils.c
gutils.c

index 295d866..e5ca5dd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2001-01-05  Tor Lillqvist  <tml@iki.fi>
+
+       * gfileutils.c (g_file_open_tmp): (Win32:) Look also for (illegal)
+       forward slashes in the template.
+
+       * gutils.c (g_path_skip_root): On Win32, skip the \\server\share
+       part of UNC paths. On all platforms, skip several initial
+       slashes. Add a few comments.
+       (g_get_any_init): On Win32, in case HOME is Unix-style with
+       (forward) slashes (some other applications apparently set it up
+       this way, convert to backslashed form.
+
+       * configure.in (glib_os): Remove stray 'v'. Add case for mingw,
+       although using configure for mingw surely doesn't work yet.
+
+       * glib.def: Update.
+
 2001-01-02  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: remove glib-config-2.0
index 295d866..e5ca5dd 100644 (file)
@@ -1,3 +1,20 @@
+2001-01-05  Tor Lillqvist  <tml@iki.fi>
+
+       * gfileutils.c (g_file_open_tmp): (Win32:) Look also for (illegal)
+       forward slashes in the template.
+
+       * gutils.c (g_path_skip_root): On Win32, skip the \\server\share
+       part of UNC paths. On all platforms, skip several initial
+       slashes. Add a few comments.
+       (g_get_any_init): On Win32, in case HOME is Unix-style with
+       (forward) slashes (some other applications apparently set it up
+       this way, convert to backslashed form.
+
+       * configure.in (glib_os): Remove stray 'v'. Add case for mingw,
+       although using configure for mingw surely doesn't work yet.
+
+       * glib.def: Update.
+
 2001-01-02  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: remove glib-config-2.0
index 295d866..e5ca5dd 100644 (file)
@@ -1,3 +1,20 @@
+2001-01-05  Tor Lillqvist  <tml@iki.fi>
+
+       * gfileutils.c (g_file_open_tmp): (Win32:) Look also for (illegal)
+       forward slashes in the template.
+
+       * gutils.c (g_path_skip_root): On Win32, skip the \\server\share
+       part of UNC paths. On all platforms, skip several initial
+       slashes. Add a few comments.
+       (g_get_any_init): On Win32, in case HOME is Unix-style with
+       (forward) slashes (some other applications apparently set it up
+       this way, convert to backslashed form.
+
+       * configure.in (glib_os): Remove stray 'v'. Add case for mingw,
+       although using configure for mingw surely doesn't work yet.
+
+       * glib.def: Update.
+
 2001-01-02  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: remove glib-config-2.0
index 295d866..e5ca5dd 100644 (file)
@@ -1,3 +1,20 @@
+2001-01-05  Tor Lillqvist  <tml@iki.fi>
+
+       * gfileutils.c (g_file_open_tmp): (Win32:) Look also for (illegal)
+       forward slashes in the template.
+
+       * gutils.c (g_path_skip_root): On Win32, skip the \\server\share
+       part of UNC paths. On all platforms, skip several initial
+       slashes. Add a few comments.
+       (g_get_any_init): On Win32, in case HOME is Unix-style with
+       (forward) slashes (some other applications apparently set it up
+       this way, convert to backslashed form.
+
+       * configure.in (glib_os): Remove stray 'v'. Add case for mingw,
+       although using configure for mingw surely doesn't work yet.
+
+       * glib.def: Update.
+
 2001-01-02  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: remove glib-config-2.0
index 295d866..e5ca5dd 100644 (file)
@@ -1,3 +1,20 @@
+2001-01-05  Tor Lillqvist  <tml@iki.fi>
+
+       * gfileutils.c (g_file_open_tmp): (Win32:) Look also for (illegal)
+       forward slashes in the template.
+
+       * gutils.c (g_path_skip_root): On Win32, skip the \\server\share
+       part of UNC paths. On all platforms, skip several initial
+       slashes. Add a few comments.
+       (g_get_any_init): On Win32, in case HOME is Unix-style with
+       (forward) slashes (some other applications apparently set it up
+       this way, convert to backslashed form.
+
+       * configure.in (glib_os): Remove stray 'v'. Add case for mingw,
+       although using configure for mingw surely doesn't work yet.
+
+       * glib.def: Update.
+
 2001-01-02  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: remove glib-config-2.0
index 295d866..e5ca5dd 100644 (file)
@@ -1,3 +1,20 @@
+2001-01-05  Tor Lillqvist  <tml@iki.fi>
+
+       * gfileutils.c (g_file_open_tmp): (Win32:) Look also for (illegal)
+       forward slashes in the template.
+
+       * gutils.c (g_path_skip_root): On Win32, skip the \\server\share
+       part of UNC paths. On all platforms, skip several initial
+       slashes. Add a few comments.
+       (g_get_any_init): On Win32, in case HOME is Unix-style with
+       (forward) slashes (some other applications apparently set it up
+       this way, convert to backslashed form.
+
+       * configure.in (glib_os): Remove stray 'v'. Add case for mingw,
+       although using configure for mingw surely doesn't work yet.
+
+       * glib.def: Update.
+
 2001-01-02  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: remove glib-config-2.0
index 295d866..e5ca5dd 100644 (file)
@@ -1,3 +1,20 @@
+2001-01-05  Tor Lillqvist  <tml@iki.fi>
+
+       * gfileutils.c (g_file_open_tmp): (Win32:) Look also for (illegal)
+       forward slashes in the template.
+
+       * gutils.c (g_path_skip_root): On Win32, skip the \\server\share
+       part of UNC paths. On all platforms, skip several initial
+       slashes. Add a few comments.
+       (g_get_any_init): On Win32, in case HOME is Unix-style with
+       (forward) slashes (some other applications apparently set it up
+       this way, convert to backslashed form.
+
+       * configure.in (glib_os): Remove stray 'v'. Add case for mingw,
+       although using configure for mingw surely doesn't work yet.
+
+       * glib.def: Update.
+
 2001-01-02  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: remove glib-config-2.0
index 295d866..e5ca5dd 100644 (file)
@@ -1,3 +1,20 @@
+2001-01-05  Tor Lillqvist  <tml@iki.fi>
+
+       * gfileutils.c (g_file_open_tmp): (Win32:) Look also for (illegal)
+       forward slashes in the template.
+
+       * gutils.c (g_path_skip_root): On Win32, skip the \\server\share
+       part of UNC paths. On all platforms, skip several initial
+       slashes. Add a few comments.
+       (g_get_any_init): On Win32, in case HOME is Unix-style with
+       (forward) slashes (some other applications apparently set it up
+       this way, convert to backslashed form.
+
+       * configure.in (glib_os): Remove stray 'v'. Add case for mingw,
+       although using configure for mingw surely doesn't work yet.
+
+       * glib.def: Update.
+
 2001-01-02  Havoc Pennington  <hp@redhat.com>
 
        * configure.in: remove glib-config-2.0
index e0cd1d1..f68f794 100644 (file)
@@ -1749,7 +1749,10 @@ case $host in
   *-*-cygwin*)
     glib_os="#define G_OS_UNIX
 #define G_WITH_CYGWIN"
-v    ;;
+    ;;
+  *-*-mingw*)
+    glib_os="#define G_OS_WIN32"
+    ;;
   *)
     glib_os="#define G_OS_UNIX"
     ;;
index 569983f..eb545dc 100644 (file)
@@ -625,7 +625,11 @@ g_file_open_tmp (const char *tmpl,
   if (tmpl == NULL)
     tmpl = ".XXXXXX";
 
-  if (strchr (tmpl, G_DIR_SEPARATOR))
+  if (strchr (tmpl, G_DIR_SEPARATOR)
+#ifdef G_OS_WIN32
+      || strchr (tmpl, '/')
+#endif
+                                   )
     {
       g_set_error (error,
                   G_FILE_ERROR,
index d56b87b..45f1473 100644 (file)
--- a/glib.def
+++ b/glib.def
@@ -231,11 +231,12 @@ EXPORTS
        g_main_context_query
        g_main_context_remove_poll
        g_main_context_set_poll_func
-       g_main_loop_destroy
        g_main_loop_is_running
        g_main_loop_new
        g_main_loop_quit
+       g_main_loop_ref
        g_main_loop_run
+       g_main_loop_unref
        g_malloc
        g_malloc0
        g_markup_error_quark
index 569983f..eb545dc 100644 (file)
@@ -625,7 +625,11 @@ g_file_open_tmp (const char *tmpl,
   if (tmpl == NULL)
     tmpl = ".XXXXXX";
 
-  if (strchr (tmpl, G_DIR_SEPARATOR))
+  if (strchr (tmpl, G_DIR_SEPARATOR)
+#ifdef G_OS_WIN32
+      || strchr (tmpl, '/')
+#endif
+                                   )
     {
       g_set_error (error,
                   G_FILE_ERROR,
index d56b87b..45f1473 100644 (file)
@@ -231,11 +231,12 @@ EXPORTS
        g_main_context_query
        g_main_context_remove_poll
        g_main_context_set_poll_func
-       g_main_loop_destroy
        g_main_loop_is_running
        g_main_loop_new
        g_main_loop_quit
+       g_main_loop_ref
        g_main_loop_run
+       g_main_loop_unref
        g_malloc
        g_malloc0
        g_markup_error_quark
index 3001ec7..957155c 100644 (file)
@@ -471,10 +471,25 @@ g_path_skip_root (gchar *file_name)
 {
   g_return_val_if_fail (file_name != NULL, NULL);
   
+#ifdef G_OS_WIN32
+  /* Skip \\server\share\ */
+  if (file_name[0] == G_DIR_SEPARATOR &&
+      file_name[1] == G_DIR_SEPARATOR &&
+      file_name[2] && 
+      strchr (file_name + 2, G_DIR_SEPARATOR) > file_name + 2)
+    return strchr (file_name + 2, G_DIR_SEPARATOR) + 1;
+#endif
+  
+  /* Skip initial slashes */
   if (file_name[0] == G_DIR_SEPARATOR)
-    return file_name + 1;
+    {
+      while (file_name[0] == G_DIR_SEPARATOR)
+       file_name++;
+      return file_name;
+    }
 
 #ifdef G_OS_WIN32
+  /* Skip X:\ */
   if (isalpha (file_name[0]) && file_name[1] == ':' && file_name[2] == G_DIR_SEPARATOR)
     return file_name + 3;
 #endif
@@ -687,15 +702,21 @@ g_get_any_init (void)
        g_home_dir = g_strdup (g_getenv ("HOME"));
       
 #ifdef G_OS_WIN32
-      if (!g_home_dir)
+      /* In case HOME is Unix-style (it happens), convert it to
+       * Windows style.
+       */
+      if (g_home_dir)
+       {
+         gchar *p;
+         while ((p = strchr (g_home_dir, '/')) != NULL)
+           *p = '\\';
+       }
+      else
        {
          /* The official way to specify a home directory on NT is
-          * the HOMEDRIVE and HOMEPATH environment variables.
-          *
-          * This is inside #ifdef G_OS_WIN32 because with the cygwin dll,
-          * HOME should be a POSIX style pathname.
+          * the HOMEDRIVE and HOMEPATH environment variables. At least
+          * it was at some time.
           */
-         
          if (getenv ("HOMEDRIVE") != NULL && getenv ("HOMEPATH") != NULL)
            {
              gchar *homedrive, *homepath;
index 3001ec7..957155c 100644 (file)
--- a/gutils.c
+++ b/gutils.c
@@ -471,10 +471,25 @@ g_path_skip_root (gchar *file_name)
 {
   g_return_val_if_fail (file_name != NULL, NULL);
   
+#ifdef G_OS_WIN32
+  /* Skip \\server\share\ */
+  if (file_name[0] == G_DIR_SEPARATOR &&
+      file_name[1] == G_DIR_SEPARATOR &&
+      file_name[2] && 
+      strchr (file_name + 2, G_DIR_SEPARATOR) > file_name + 2)
+    return strchr (file_name + 2, G_DIR_SEPARATOR) + 1;
+#endif
+  
+  /* Skip initial slashes */
   if (file_name[0] == G_DIR_SEPARATOR)
-    return file_name + 1;
+    {
+      while (file_name[0] == G_DIR_SEPARATOR)
+       file_name++;
+      return file_name;
+    }
 
 #ifdef G_OS_WIN32
+  /* Skip X:\ */
   if (isalpha (file_name[0]) && file_name[1] == ':' && file_name[2] == G_DIR_SEPARATOR)
     return file_name + 3;
 #endif
@@ -687,15 +702,21 @@ g_get_any_init (void)
        g_home_dir = g_strdup (g_getenv ("HOME"));
       
 #ifdef G_OS_WIN32
-      if (!g_home_dir)
+      /* In case HOME is Unix-style (it happens), convert it to
+       * Windows style.
+       */
+      if (g_home_dir)
+       {
+         gchar *p;
+         while ((p = strchr (g_home_dir, '/')) != NULL)
+           *p = '\\';
+       }
+      else
        {
          /* The official way to specify a home directory on NT is
-          * the HOMEDRIVE and HOMEPATH environment variables.
-          *
-          * This is inside #ifdef G_OS_WIN32 because with the cygwin dll,
-          * HOME should be a POSIX style pathname.
+          * the HOMEDRIVE and HOMEPATH environment variables. At least
+          * it was at some time.
           */
-         
          if (getenv ("HOMEDRIVE") != NULL && getenv ("HOMEPATH") != NULL)
            {
              gchar *homedrive, *homepath;