After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 8616 - Portable path handling API
Portable path handling API
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: general
unspecified
Other other
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
: 336531 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2000-04-08 03:45 UTC by terra
Modified: 2011-02-18 16:13 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description terra 2001-01-27 17:28:24 UTC
Package: glib
Version: cvs

Looking at the source, there is no way that g_basename handles
dos' (and thus win32's) two directory separators: slash and
backslash.  It handles only whatever G_DIR_SEPARATOR is.

It has to map as follows:

c:/foo/bar     --> bar
c:\foo\bar     --> bar

(Other functions, like g_path_is_absolute, need similar attention.)

Morten




------- Additional Comments From tml@iki.fi 2000-04-14 23:52:48 ----

Subject: Bug#8616: g_basename does not work right on Win32
From: Tor Lillqvist <tml@iki.fi>
To: 8616@bugs.gnome.org
Message-Id: <14583.59280.260000.479478@gargle.gargle.HOWL>
Date: Sat, 15 Apr 2000 06:52:48 +0300 (FLE Daylight Time)

Morten Welinder writes:
 > Looking at the source, there is no way that g_basename handles
 > dos' (and thus win32's) two directory separators: slash and
 > backslash. It handles only whatever G_DIR_SEPARATOR is.

 > (Other functions, like g_path_is_absolute, need similar attention.)

But is it useful just to fix this, while there still is tons of
application code that looks in path names for G_DIR_SEPARATORs only? I
think it is easier to just pretend that the only legal pathname
component separator on Win32 in the backslash. (That's what end users
use, anyway, isn't it?)

To properly fix this mess, one would need to fully abstract the whole
pathname concept, and not try to handle them with manual string
scanning at all. As a bonus (?), one might then get something that
would work even on "interesting" systems like VMS, where the path
names are very different from either Unix or Win32.

--tml




------- Bug moved to this database by debbugs-export@bugzilla.gnome.org 2001-01-27 12:28 -------
This bug was previously known as bug 8616 at http://bugs.gnome.org/
http://bugs.gnome.org/show_bug.cgi?id=8616
Originally filed under the glib product and general component.

The original reporter (terra@diku.dk) of this bug does not have an account here.
Reassigning to the exporter, debbugs-export@bugzilla.gnome.org.
Reassigning to the default owner of the component, gtkdev@gtk.org.

Comment 1 Havoc Pennington 2001-01-27 19:38:30 UTC
I think this would be properly addressed in some kind of portable file
I/O layer feature for GLib, which would abstract paths,
open/close/read files, etc. Not going to happen for 2.0.
Comment 2 Havoc Pennington 2001-01-29 19:29:20 UTC
Moving GLib bugs with API keyword to the API freeze milestone
Comment 3 Havoc Pennington 2001-02-16 23:11:07 UTC
Will investigate this post-2.0
Comment 4 Ryan McDougall 2004-01-15 20:27:38 UTC
What are we looking for with this bug? Something which automatically
parses UNC or URI pathes too? Is this not handled by GnomeVFS? We
should consider the relevancy of this bug.
Comment 5 Matthias Clasen 2006-03-29 19:34:15 UTC
*** Bug 336531 has been marked as a duplicate of this bug. ***
Comment 6 Federico Mena Quintero 2006-03-30 02:13:18 UTC
FWIW, we can steal a bunch of code from the Midnight Commander to do this.  It has very robust functions to deal with path strings:

- Compress a path with ".." and "." and multiple slashes

- Canonicalize symlinks

- etc.
Comment 7 Tor Lillqvist 2006-03-30 06:30:02 UTC
Re: my old comment at the start, we now do have a macro G_IS_DIR_SEPARATOR which hides the fact that either / or \ are valid on Windows. And all GLib path manipulation functions now look for either separator on Windows, which they didn't do back in 2000, IIRC.


Comment 8 Wouter Bolsterlee (uws) 2006-03-30 08:48:05 UTC
JFYI, readlink(1) has some path handling code too (canonicalizing symlinks and such).
Comment 9 Matthias Clasen 2006-03-30 15:35:32 UTC
Note that we already have at least two copies of path canonicalization functions
in GTK+
Comment 10 Wouter Bolsterlee (uws) 2007-12-31 12:04:06 UTC
Isn't this something that GIO should take care of?
Comment 11 Mathias Hasselmann (IRC: tbf) 2007-12-31 12:23:32 UTC
Fixed with Bug 117925. Obsoleted by g_path_get_basename() and gio.
Obviously a lost soul this bug.