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 534169 - Add API to know if a GFile is "valid"
Add API to know if a GFile is "valid"
Status: RESOLVED DUPLICATE of bug 550110
Product: glib
Classification: Platform
Component: gio
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: Alexander Larsson
gtkdev
Depends on:
Blocks:
 
 
Reported: 2008-05-21 09:44 UTC by Vincent Untz
Modified: 2008-09-02 16:29 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Vincent Untz 2008-05-21 09:44:32 UTC
From the g_file_new_for_uri doc:

Constructs a GFile for a given URI. This operation never fails, but the returned object might not support any I/O operation if uri is malformed or if the uri type is not supported.

That's cool. But I'd like to know if the URI I gave was malformed so I can do some special stuff. It seems there's no way to know that. Something like a g_file_is_valid(GFile *file) API would help, I guess.
Comment 1 Alexander Larsson 2008-05-23 19:02:05 UTC
Isn't g_uri_is_valid a better approach? The validity of a GFile seems less defined than a uri. 

Of course, uri validity (and in general GFile validity) is a complicated issue. How would you define what valid is? Is a mailto: uri valid? Is a (currently) unsupported uri scheme valid?
Comment 2 Vincent Untz 2008-05-27 20:32:01 UTC
(In reply to comment #1)
> Isn't g_uri_is_valid a better approach? The validity of a GFile seems less
> defined than a uri. 

To be honest, I'd have to remember the exact context in which I opened this bug, and I can't :/ g_uri_is_valid could be enough for most cases.

> Of course, uri validity (and in general GFile validity) is a complicated issue.
> How would you define what valid is? Is a mailto: uri valid? Is a (currently)
> unsupported uri scheme valid?

Nod. And in fact, I'm starting to wonder if we didn't already have this discussion a few months ago ;-)
Comment 3 Matthias Clasen 2008-09-02 16:29:49 UTC
Lets declare this a dupe of bug 550110

*** This bug has been marked as a duplicate of 550110 ***