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 688074 - g_filename_from_uri doesn't work properly with Windows URIs (i.e.: file:///C:/foo.bar)
g_filename_from_uri doesn't work properly with Windows URIs (i.e.: file:///C:...
Status: VERIFIED NOTABUG
Product: glib
Classification: Platform
Component: gio
2.34.x
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-11-11 02:38 UTC by Andrés G. Aragoneses (IRC: knocte)
Modified: 2012-11-11 15:36 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Andrés G. Aragoneses (IRC: knocte) 2012-11-11 02:38:35 UTC
g_filename_from_uri ("file:///C:/foo.bar")

returns currently "/C:/foo.bar

expected: "C:/foo.bar" or "C:\foo.bar"

PS: I'm not setting "OS" to "Windows", because this conversion should also work in Linux.
Comment 1 Dan Winship 2012-11-11 15:07:38 UTC
No, g_filename_from_uri() is supposed to return an absolute pathname, and "C:/foo.bar" is not an absolute pathname on unix. Furthermore, on unix, you could potentially have a directory named "C:" at the top level of your filesystem, and in that case, "file:///C:/foo.bar" would be how you would refer to a file in that directory.

glib/tests/uri.c explicitly checks that "file:///c:/foo" resolves to "c:\foo" on windows and "/c:/foo" on unix.
Comment 2 Andrés G. Aragoneses (IRC: knocte) 2012-11-11 15:36:16 UTC
Fair enough, sorry for the noise.

I somehow thought that ":" was an illegal character on unix, just because of the fact that it is a path separator character (in the same way the path separator character in Windows is ";" and therefore it is illegal in a path*).

*Although, I just tried this in Windows2008Server, and it is legal! So I don't know where I got that idea from, maybe it was illegal in older versions of Windows?

Thanks for the help anyway.