Code review comment for ~didrocks/ubuntu/+source/gnome-shell:resolve-gdm-symlink

Revision history for this message
Marco Trevisan (TreviƱo) (3v1n0) wrote :

I'd avoid to do the C changes, while you can just use something like this:

try {
    while (GLib.file_test(path, GLib.FileTest.IS_SYMLINK))
        path = GLib.file_read_link(path)
} catch (e) {}

Or even avoiding the file_test check (and replacing it with `true`, since the catch will stop the while anyway).

Another option, just using GFile is instead:

while (true) {
    let info = stylesheet.query_info(Gio.FILE_ATTRIBUTE_STANDARD_IS_SYMLINK+","+
                                     Gio.FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET,
                                     Gio.FileQueryInfoFlags.NONE, null)
    if (!info.get_is_symlink())
        break;

    stylesheet = Gio.file_new_for_path(info.get_symlink_target())
}

So we have less stuff touched and we keep using the glib way.

Also please mention in the patch msg that this could be removed when we've a session refactor as part of this https://gitlab.gnome.org/GNOME/gdm/merge_requests/33

« Back to merge proposal