UNLINK_ONLY macro to work correctly for windows.

This commit is contained in:
dolphin6k 2021-10-30 07:34:30 +09:00
parent 87ed5bc991
commit 8d23668589
2 changed files with 6 additions and 13 deletions

View file

@ -358,6 +358,8 @@ static void mtw(wchar_t * wtok, char *tok, size_t size)
iconv_close(trans); iconv_close(trans);
} }
extern int win32_trash(char *path);
#endif /* WIN32 */ #endif /* WIN32 */
#if defined(__MACOS__) #if defined(__MACOS__)
@ -2137,16 +2139,7 @@ static float pick_best_scape(unsigned int orig_w, unsigned int orig_h, unsigned
#endif #endif
static SDL_Surface *myIMG_Load_RWops(const char *file); static SDL_Surface *myIMG_Load_RWops(const char *file);
static SDL_Surface *myIMG_Load(const char *file); static SDL_Surface *myIMG_Load(const char *file);
#ifndef WIN32
static int trash(char *path); static int trash(char *path);
#else
#ifndef UNLINK_ONLY
extern int win32_trash(char *path);
#define trash(file) win32_trash(file)
#else
static int trash(char *path);
#endif
#endif
int file_exists(char *path); int file_exists(char *path);
int generate_fontconfig_cache_spinner(SDL_Surface * screen); int generate_fontconfig_cache_spinner(SDL_Surface * screen);
@ -25860,11 +25853,13 @@ int main(int argc, char *argv[])
/** /**
* FIXME * FIXME
*/ */
#ifndef WIN32
static int trash(char *path) static int trash(char *path)
{ {
#ifdef UNLINK_ONLY #ifdef UNLINK_ONLY
return (unlink(path)); return (unlink(path));
#else
#ifdef WIN32
return win32_trash(path);
#else #else
char fname[MAX_PATH], trashpath[MAX_PATH], dest[MAX_PATH], infoname[MAX_PATH], bname[MAX_PATH], ext[MAX_PATH]; char fname[MAX_PATH], trashpath[MAX_PATH], dest[MAX_PATH], infoname[MAX_PATH], bname[MAX_PATH], ext[MAX_PATH];
char deldate[32]; char deldate[32];
@ -26031,9 +26026,9 @@ static int trash(char *path)
/* FIXME: Haiku */ /* FIXME: Haiku */
return (0); return (0);
#endif /* WIN32 */
#endif /* UNLINK_ONLY */ #endif /* UNLINK_ONLY */
} }
#endif
/** /**
* FIXME * FIXME

View file

@ -1,6 +1,4 @@
#include <windows.h> #include <windows.h>
#include <string.h>
#include <stdlib.h>
int win32_trash(char *path); int win32_trash(char *path);
int win32_trash(char *path) int win32_trash(char *path)