diff --git a/app/utils/dirs.c b/app/utils/dirs.c index 28c0741c..c9c5dea2 100644 --- a/app/utils/dirs.c +++ b/app/utils/dirs.c @@ -243,7 +243,8 @@ struct dir_path { static int rmdir_w_msg(const char *path, int *err) { #ifdef WIN32 if (!RemoveDirectoryA(path)) { - zsv_win_printLastError(); + zsv_perror(path); + // zsv_win_printLastError(); *err = 1; } #else diff --git a/app/utils/file.c b/app/utils/file.c index da88004f..a0edaa2f 100644 --- a/app/utils/file.c +++ b/app/utils/file.c @@ -14,6 +14,7 @@ #include // open #include +#include #include /** @@ -29,7 +30,9 @@ char *zsv_get_temp_filename(const char *prefix) { TCHAR lpTempPathBuffer[MAX_PATH]; DWORD dwRetVal = GetTempPath(MAX_PATH, // length of the buffer lpTempPathBuffer); // buffer for path - if (dwRetVal > 0 && dwRetVal < MAX_PATH) { + if (!(dwRetVal > 0 && dwRetVal < MAX_PATH)) + zsv_perror("GetTempPath"); + else { char szTempFileName[MAX_PATH]; UINT uRetVal = GetTempFileName(lpTempPathBuffer, // directory for tmp files TEXT(prefix), // temp file name prefix @@ -37,7 +40,10 @@ char *zsv_get_temp_filename(const char *prefix) { szTempFileName); // buffer for name if (uRetVal > 0) return strdup(szTempFileName); + zsv_perror(lpTempPathBuffer); + fprintf(stderr, " prefix: %s\n", prefix); } + return NULL; } #else diff --git a/app/utils/os.c b/app/utils/os.c index 6718230f..2b87d827 100644 --- a/app/utils/os.c +++ b/app/utils/os.c @@ -72,7 +72,7 @@ int zsv_replace_file(const void *src, const void *dest) { return 1; // fail } -void zsv_win_printLastError(void) { +static void zsv_win_printLastError(void) { DWORD dw = GetLastError(); LPVOID lpMsgBuf; LPVOID lpDisplayBuf; diff --git a/include/zsv/utils/os.h b/include/zsv/utils/os.h index cb23336b..0a7ed9a9 100644 --- a/include/zsv/utils/os.h +++ b/include/zsv/utils/os.h @@ -28,8 +28,8 @@ int zsv_replace_file(const void *src, const void *dest); /** * Windows does not have perror(), so we define our own printLastError() +void zsv_win_printLastError(const char *prefix); */ -void zsv_win_printLastError(); #endif