[PATCH v3 5/7] test: Make cairo_test_mkdir() usable throughout tests
"Bryce W. Harrington" <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
Signed-off-by: Bryce Harrington <[email protected]> --- test/cairo-test.c | 18 ++++++++++++++++++ test/cairo-test.h | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/test/cairo-test.c b/test/cairo-test.c index a3a587a..4f0610b 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -1791,3 +1791,21 @@ cairo_test_status_from_status (const cairo_test_context_t *ctx, return CAIRO_TEST_FAILURE; } + +cairo_bool_t +cairo_test_mkdir (const char *path) +{ +#if ! HAVE_MKDIR + return FALSE; +#elif HAVE_MKDIR == 1 + if (mkdir (path) == 0) + return TRUE; +#elif HAVE_MKDIR == 2 + if (mkdir (path, 0770) == 0) + return TRUE; +#else +#error Bad value for HAVE_MKDIR +#endif + + return errno == EEXIST; +} diff --git a/test/cairo-test.h b/test/cairo-test.h index 87ba7df..1dcd59b 100644 --- a/test/cairo-test.h +++ b/test/cairo-test.h @@ -318,6 +318,10 @@ cairo_test_get_reference_image (cairo_test_context_t *ctx, const char *filename, cairo_bool_t flatten); + +cairo_bool_t +cairo_test_mkdir (const char *path); + CAIRO_END_DECLS #endif -- 1.7.9.5 -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo