Giter Club home page Giter Club logo

Comments (10)

EPashkin avatar EPashkin commented on July 2, 2024

By https://gitlab.gnome.org/GNOME/glib/blob/master/gio/gfile.c#L6835 get_uri_scheme can return NULL in some cases.
At minimum get_uri implementation return NULL for nonabsolute paths
https://gitlab.gnome.org/GNOME/glib/blob/master/gio/glocalfile.c#L277
https://gitlab.gnome.org/GNOME/glib/blob/master/glib/gconvert.c#L1774

from gio.

sophie-h avatar sophie-h commented on July 2, 2024

I think GFile has no concept/representation of relative paths. Relative arguments to g_file_new_for_path() lead to an absolute representation in g_file_get_uri(). Also, NULL is not documented as return value.

from gio.

EPashkin avatar EPashkin commented on July 2, 2024

You right, for relative paths GLocalFile doing canonicalize.
I found only one call in gio, that checks it result for NULL: https://gitlab.gnome.org/GNOME/glib/blob/master/gio/win32/gwinhttpfile.c#L243,
so maybe you right about get_uri

from gio.

sdroege avatar sdroege commented on July 2, 2024

So anything that has to be done here?

from gio.

sophie-h avatar sophie-h commented on July 2, 2024

@sdroege it's probably more the question where to start? There is a lot of functions that don't need to return an Option. I don't know if it is really efficient if I am opening an issue for every singe function (#158, gtk-rs/gtk#709).

from gio.

sdroege avatar sdroege commented on July 2, 2024

Well, it needs someone to systematically go over all these functions and check what would be correct, and then make a PR with the changes :) If you don't plan to do that, just doing an issue for every (group of) functions you find that look wrong is fine too.

The functions mentioned here seem to be correct though? Unlikely that they return None but unfortunately that can

from gio.

sdroege avatar sdroege commented on July 2, 2024

Let's close this then. Please open new issues for everything you notice that shouldn't return an Option :)

from gio.

sophie-h avatar sophie-h commented on July 2, 2024

The functions mentioned here seem to be correct though? Unlikely that they return None but unfortunately that can

I don't think so.

from gio.

sdroege avatar sdroege commented on July 2, 2024

Checked again and you're right that these functions shouldn't return an Option. The discussion above confused me! Will fix :)

from gio.

sdroege avatar sdroege commented on July 2, 2024

See #221

from gio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.