diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2022-01-06 08:15:26 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2022-01-06 08:39:33 +0100 |
commit | bb67df716cfab257a6309df121e6399ddadcc78a (patch) | |
tree | db9ff5a0ff87819499c2d2aa24eff5e1f9291ab4 /fiv-sidebar.c | |
parent | 4cd2978e21e47182948e9875111de56273219b89 (diff) | |
download | fiv-bb67df716cfab257a6309df121e6399ddadcc78a.tar.gz fiv-bb67df716cfab257a6309df121e6399ddadcc78a.tar.xz fiv-bb67df716cfab257a6309df121e6399ddadcc78a.zip |
Mildly improve Ubuntu 20.04 compatibility
Diffstat (limited to 'fiv-sidebar.c')
-rw-r--r-- | fiv-sidebar.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/fiv-sidebar.c b/fiv-sidebar.c index c29ef4d..e956d08 100644 --- a/fiv-sidebar.c +++ b/fiv-sidebar.c @@ -244,10 +244,21 @@ resolve_location(FivSidebar *self, const char *text) // Relative paths produce invalid GFile objects with this function. // And even if they didn't, we have our own root for them. GFile *file = g_file_parse_name(text); - if (g_uri_is_valid(text, G_URI_FLAGS_PARSE_RELAXED, NULL) || - g_file_peek_path(file)) + if (g_file_peek_path(file)) return file; + // Neither branch looks like a particularly good solution. + // Though in general, false positives are preferred over negatives. +#if GLIB_CHECK_VERSION(2, 66, 0) + if (g_uri_is_valid(text, G_URI_FLAGS_PARSE_RELAXED, NULL)) + return file; +#else + gchar *scheme = g_uri_parse_scheme(text); + g_free(scheme); + if (scheme) + return file; +#endif + GFile *absolute = g_file_get_child_for_display_name( fiv_io_model_get_location(self->model), text, NULL); if (!absolute) |