From ccc00f9278904bdff36b223500e0dc18e86f2431 Mon Sep 17 00:00:00 2001 From: Yury Popov Date: Fri, 9 Dec 2022 23:27:26 +0300 Subject: [PATCH] tests: api: allow both case of pathsep --- tests/api.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/api.c b/tests/api.c index 288b327e..95541903 100644 --- a/tests/api.c +++ b/tests/api.c @@ -630,8 +630,11 @@ main(int argc, char **argv) (void)argc; // unused parameter char *progdir = strdup(argv[0]); - char *dir = strrchr(progdir, PATHSEP); - if (dir != NULL) *dir = 0; + + // Path separator on windows may be both '/' and '\' + char *dir; + if ((dir = strrchr(progdir, PATHSEP)) != NULL) *dir = 0; + else if ((dir = strrchr(progdir, '/')) != NULL) *dir = 0; test_espeak_terminate_without_initialize(); test_espeak_initialize();