diff --git a/CMakeLists.txt b/CMakeLists.txt index 030a31344..8c59c62e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -921,7 +921,9 @@ endif() if(BUILD_UPDATER) add_executable(updater-stub WIN32 ${CMAKE_CURRENT_SOURCE_DIR}/src/feature/updater-main.c) target_link_libraries(updater-stub ${OS_LIB} ${PLATFORM_LIBRARY} ${BINARY_NAME}) - if(NOT MSVC) + if(MSVC) + set_target_properties(updater-stub PROPERTIES LINK_FLAGS /ENTRY:mainCRTStartup) + else() set_target_properties(updater-stub PROPERTIES LINK_FLAGS_RELEASE -s) set_target_properties(updater-stub PROPERTIES LINK_FLAGS_RELWITHDEBINFO -s) endif() diff --git a/src/feature/updater-main.c b/src/feature/updater-main.c index 8487581ec..367dff9f5 100644 --- a/src/feature/updater-main.c +++ b/src/feature/updater-main.c @@ -16,6 +16,7 @@ #include #include #include +#include #define mkdir(X, Y) _mkdir(X) #elif defined(_POSIX_C_SOURCE) @@ -52,7 +53,11 @@ bool extractArchive(struct VDir* archive, const char* root) { errno = 0; vfOut = VFileOpen(path, O_WRONLY | O_CREAT | O_TRUNC); if (!vfOut && errno == EACCES) { +#ifdef _WIN32 + Sleep(1000); +#else sleep(1); +#endif vfOut = VFileOpen(path, O_WRONLY | O_CREAT | O_TRUNC); } if (!vfOut) {