From 80e13a37328521d9f696e60662c300b80e7b4106 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Sat, 18 May 2024 23:47:51 +0200 Subject: tools/afcclient: Fix build for Windows --- tools/afcclient.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/afcclient.c b/tools/afcclient.c index 25b0383..71a1c32 100644 --- a/tools/afcclient.c +++ b/tools/afcclient.c @@ -771,6 +771,15 @@ static uint8_t get_single_file(afc_client_t afc, const char *srcpath, const char return succeed; } +static int __mkdir(const char* path) +{ +#ifdef WIN32 + return mkdir(path); +#else + return mkdir(path, 0755); +#endif +} + static uint8_t get_file(afc_client_t afc, const char *srcpath, const char *dstpath, uint8_t force_overwrite, uint8_t recursive_get) { char **info = NULL; @@ -817,7 +826,7 @@ static uint8_t get_file(afc_client_t afc, const char *srcpath, const char *dstpa printf("Error: Failed to write into existing directory without '-f': %s\n", dstpath); return 0; } - } else if (mkdir(dstpath, 0777) != 0) { + } else if (__mkdir(dstpath) != 0) { printf("Error: Failed to create directory '%s': %s\n", dstpath, strerror(errno)); afc_dictionary_free(entries); return 0; -- cgit v1.1-32-gdbae