diff options
author | Liam <30486941+liamHowatt@users.noreply.github.com> | 2024-04-18 09:12:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-18 15:12:50 +0200 |
commit | e72f52d0bd6da413cd36754afc975a7c4ecc9ee3 (patch) | |
tree | 097e6c5d0f160665d638c285b57383923902beca /tests/unity/unity_support.c | |
parent | d0436fbb597e3ba5d69d65af187a542f8db26f1e (diff) | |
download | lvgl-e72f52d0bd6da413cd36754afc975a7c4ecc9ee3.tar.gz lvgl-e72f52d0bd6da413cd36754afc975a7c4ecc9ee3.zip |
feat(CI): Windows MSVC and GCC build (#6015)
Diffstat (limited to 'tests/unity/unity_support.c')
-rw-r--r-- | tests/unity/unity_support.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/tests/unity/unity_support.c b/tests/unity/unity_support.c index e5e4c3a22..c045d6ddf 100644 --- a/tests/unity/unity_support.c +++ b/tests/unity/unity_support.c @@ -13,16 +13,23 @@ *********************/ #if LV_BUILD_TEST #include "../lvgl.h" -#include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <stdarg.h> -#include <sys/stat.h> +#include <errno.h> #include "unity.h" #define PNG_DEBUG 3 #include <png.h> +#ifdef _WIN32 +#include <direct.h> +#define mkdir(pathname, mode) _mkdir(pathname) +#define strtok_r strtok_s +#else +#include <sys/stat.h> +#endif + /********************* * DEFINES *********************/ @@ -429,21 +436,20 @@ static void create_folders_if_needed(const char * path) char * token = strtok_r(pathCopy, "/", &ptr); char current_path[1024] = {'\0'}; // Adjust the size as needed - struct stat st; while(token && ptr && *ptr != '\0') { strcat(current_path, token); strcat(current_path, "/"); - if(stat(current_path, &st) != 0) { - // Folder doesn't exist, create it - if(mkdir(current_path, 0777) != 0) { - perror("Error creating folder"); - free(pathCopy); - exit(EXIT_FAILURE); - } + int mkdir_retval = mkdir(current_path, 0777); + if (mkdir_retval == 0) { printf("Created folder: %s\n", current_path); } + else if (errno != EEXIST) { + perror("Error creating folder"); + free(pathCopy); + exit(EXIT_FAILURE); + } token = strtok_r(NULL, "/", &ptr); } |