Initial implimentation of win32_trash()

This commit is contained in:
dolphin6k 2021-10-28 22:47:32 +09:00
parent 75d209e3f1
commit 61ce0798d9
3 changed files with 29 additions and 1 deletions

View file

@ -158,7 +158,7 @@ macos_BUNDLE:=./TuxPaint.app
ios_BUNDLE:=./TuxPaint-$(SDK).app
BUNDLE:=$($(OS)_BUNDLE)
windows_ARCH_LIBS:=obj/win32_print.o obj/resource.o
windows_ARCH_LIBS:=obj/win32_print.o obj/resource.o obj/win32_trash.o
macos_ARCH_LIBS:=src/macos_print.m obj/macos.o
ios_ARCH_LIBS:=src/ios_print.m obj/ios.o
beos_ARCH_LIBS:=obj/BeOS_print.o
@ -1262,6 +1262,12 @@ obj/win32_print.o: src/win32_print.c src/win32_print.h src/debug.h
@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(DEFS) \
-c src/win32_print.c -o obj/win32_print.o
obj/win32_trash.o: src/win32_trash.c src/debug.h
@echo
@echo "...Compiling win32 trash support..."
@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(DEFS) \
-c src/win32_trash.c -o obj/win32_trash.o
obj/postscript_print.o: src/postscript_print.c \
src/postscript_print.h src/debug.h
@echo

View file

@ -2137,7 +2137,14 @@ static float pick_best_scape(unsigned int orig_w, unsigned int orig_h, unsigned
#endif
static SDL_Surface *myIMG_Load_RWops(const char *file);
static SDL_Surface *myIMG_Load(const char *file);
#ifndef WIN32
static int trash(char *path);
#else
#ifndef UNLINK_ONLY
static int win32_trash(char *path);
#define trash(file) win32_trash(file)
#endif
#endif
int file_exists(char *path);
int generate_fontconfig_cache_spinner(SDL_Surface * screen);
@ -25851,6 +25858,7 @@ int main(int argc, char *argv[])
/**
* FIXME
*/
#ifndef WIN32
static int trash(char *path)
{
#ifdef UNLINK_ONLY
@ -26023,6 +26031,7 @@ static int trash(char *path)
return (0);
#endif /* UNLINK_ONLY */
}
#endif
/**
* FIXME

13
src/win32_trash.c Normal file
View file

@ -0,0 +1,13 @@
#include <windows.h>
int win32_trash(char *path);
int win32_trash(char *path)
{
SHFILEOPSTRUCT op;
op.wFunc = FO_DELETE;
op.pFrom = path;
op.fFlags = FOF_SILENT|FOF_ALLOWUNDO;
return SHFileOperationA(&op);
}