summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-12-11 13:41:19 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2018-12-11 14:47:01 +0100
commit8ae5adcf00bfe63f631013f48865c0539b888599 (patch)
tree862f07c01edf135a1ddb353f177324d9f16aacc3 /tests
parentf6e17d13292ad933327514a2a314a28d402529d2 (diff)
downloadgdk-pixbuf-8ae5adcf00bfe63f631013f48865c0539b888599.tar.gz
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/pixbuf-reftest.c22
1 files changed, 22 insertions, 0 deletions
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);