Use OS-dependent separator for G_RESOURCE_OVERLAYS

G_RESOURCE_OVERLAYS is a list of resource-path and filesystem-path pairs.
Since on Windows filesystem paths use ':', this list can't be ':'-separated
there. Fix that by making it ';'-separated on Windows. Make the parser
error clearer (we're not looking for a slash, we're looking for an absolute
path).
This commit is contained in:
Руслан Ижбулатов 2019-02-08 20:27:23 +00:00 committed by Philip Withnall
parent ccbadcfb04
commit 294d818336

View File

@ -151,7 +151,7 @@ G_DEFINE_BOXED_TYPE (GResource, g_resource, g_resource_ref, g_resource_unref)
* When debugging a program or testing a change to an installed version, it is often useful to be able to
* replace resources in the program or library, without recompiling, for debugging or quick hacking and testing
* purposes. Since GLib 2.50, it is possible to use the `G_RESOURCE_OVERLAYS` environment variable to selectively overlay
* resources with replacements from the filesystem. It is a colon-separated list of substitutions to perform
* resources with replacements from the filesystem. It is a %G_SEARCHPATH_SEPARATOR-separated list of substitutions to perform
* during resource lookups.
*
* A substitution has the form
@ -332,7 +332,7 @@ g_resource_find_overlay (const gchar *path,
gchar **parts;
gint i, j;
parts = g_strsplit (envvar, ":", 0);
parts = g_strsplit (envvar, G_SEARCHPATH_SEPARATOR_S, 0);
/* Sanity check the parts, dropping those that are invalid.
* 'i' may grow faster than 'j'.
@ -378,9 +378,9 @@ g_resource_find_overlay (const gchar *path,
continue;
}
if (eq[1] != '/')
if (!g_path_is_absolute (eq + 1))
{
g_critical ("G_RESOURCE_OVERLAYS segment '%s' lacks leading '/' after '='. Ignoring", part);
g_critical ("G_RESOURCE_OVERLAYS segment '%s' does not have an absolute path after '='. Ignoring", part);
g_free (part);
continue;
}