From 6338f865ad83e87eb263571e15895d20d2d547d9 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Wed, 26 Feb 2020 00:58:54 +0100 Subject: [PATCH] tests: avoid \\ in path (win32) --- src/tests/testmain.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tests/testmain.c b/src/tests/testmain.c index 85e299cd..e41b87a2 100644 --- a/src/tests/testmain.c +++ b/src/tests/testmain.c @@ -116,6 +116,7 @@ int init(void) { #ifdef WIN32 char temp[256]; + DWORD len; #endif srandom(time(NULL)); #ifdef ENABLE_FILENAMES_ICONV @@ -131,8 +132,9 @@ int init(void) #endif #endif /* ENABLE_FILENAMES_ICONV */ #ifdef WIN32 - GetTempPathA(sizeof(temp), temp); - snprintf(tmpdir, sizeof(tmpdir), "%s%sgrafx2-test.XXXXXX", temp, PATH_SEPARATOR); + len = GetTempPathA(sizeof(temp), temp); + snprintf(tmpdir, sizeof(tmpdir), "%s%sgrafx2-test.XXXXXX", + temp, temp[len-1] == PATH_SEPARATOR[0] ? "" : PATH_SEPARATOR); #else snprintf(tmpdir, sizeof(tmpdir), "%s%sgrafx2-test.XXXXXX", "/tmp", PATH_SEPARATOR); #endif