diff options
author | Adrian Johnson <ajohnson@redneon.com> | 2022-05-18 10:37:37 +0930 |
---|---|---|
committer | Adrian Johnson <ajohnson@redneon.com> | 2022-05-19 06:44:58 +0930 |
commit | 29acc5584915be294b2d7ed926d9ac48346474e3 (patch) | |
tree | c9d037cf671c58de5eb048233c645f7c42c59e35 /test/cairo-test.c | |
parent | e562ff757bb7d88b708e07a9759c046413c52f94 (diff) | |
download | cairo-29acc5584915be294b2d7ed926d9ac48346474e3.tar.gz |
Make it easier for cairo-test-suite to find the source dir
Diffstat (limited to 'test/cairo-test.c')
-rw-r--r-- | test/cairo-test.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test/cairo-test.c b/test/cairo-test.c index df230e523..cbd4fb1ab 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -196,9 +196,14 @@ _cairo_test_init (cairo_test_context_t *ctx, ctx->own_targets = TRUE; ctx->srcdir = getenv ("srcdir"); - if (ctx->srcdir == NULL) - ctx->srcdir = "."; - + if (ctx->srcdir == NULL) { + ctx->srcdir = "."; +#if HAVE_SYS_STAT_H + struct stat st; + if (stat ("srcdir", &st) == 0 && (st.st_mode & S_IFDIR)) + ctx->srcdir = "srcdir"; +#endif + } ctx->refdir = getenv ("CAIRO_REF_DIR"); } |