GNOME Bugzilla – Bug 534169
Add API to know if a GFile is "valid"
Last modified: 2008-09-02 16:29:49 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.
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?
(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 ;-)
Lets declare this a dupe of bug 550110 *** This bug has been marked as a duplicate of 550110 ***