From 8ae5adcf00bfe63f631013f48865c0539b888599 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Tue, 11 Dec 2018 13:41:19 +0100 Subject: tests/pixbuf-reftest: Work around broken symlinks on Windows When cloning the repo with git on Windows the symlinks end up being normal files which contain the target path as text. Make this kinda work by detecting if the files contain ascii only and then treating the content as a filename in the parent directory. --- tests/pixbuf-reftest.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests') diff --git a/tests/pixbuf-reftest.c b/tests/pixbuf-reftest.c index fd5414618..caf841c6c 100644 --- a/tests/pixbuf-reftest.c +++ b/tests/pixbuf-reftest.c @@ -85,6 +85,28 @@ make_ref_file (GFile *file) result = g_file_new_for_uri (ref_uri); +#ifdef G_OS_WIN32 + /* XXX: The .ref.png files are symlinks and on Windows git will create + * files containing the symlink target instead of symlinks. */ + { + char *contents; + gboolean success; + + success = g_file_load_contents (result, NULL, &contents, NULL, NULL, NULL); + if (success) + { + if (g_str_is_ascii (contents)) + { + GFile *parent = g_file_get_parent (result); + g_object_unref (result); + result = g_file_get_child (parent, contents); + g_object_unref (parent); + } + g_free (contents); + } + } +#endif + g_free (ref_uri); g_free (uri); -- cgit v1.2.1