[sylverant] r760 committed - This should fix updating archives on windows.

1 view
Skip to first unread message

sylv...@googlecode.com

unread,
Nov 22, 2014, 1:23:46 AM11/22/14
to sylverant-...@googlegroups.com
Revision: 760
Author: blue...@gmail.com
Date: Sat Nov 22 06:23:30 2014 UTC
Log: This should fix updating archives on windows.

https://code.google.com/p/sylverant/source/detail?r=760

Modified:
/trunk/pso_tools/pso_artool/Makefile.win32
/trunk/pso_tools/pso_artool/afs.c
/trunk/pso_tools/pso_artool/gsl.c
/trunk/pso_tools/pso_artool/windows_compat.c

=======================================
--- /trunk/pso_tools/pso_artool/Makefile.win32 Wed Nov 19 19:43:59 2014 UTC
+++ /trunk/pso_tools/pso_artool/Makefile.win32 Sat Nov 22 06:23:30 2014 UTC
@@ -11,5 +11,5 @@
.c.obj:
$(cc) $(cdebug) $(cflags) $(cvars) $*.c /D_CRT_SECURE_NO_WARNINGS

-pso_dns.exe: $(OBJS)
- $(link) $(ldebug) $(conflags) -out:pso_dns.exe $(OBJS) $(conlibs)
+pso_artool.exe: $(OBJS)
+ $(link) $(ldebug) $(conflags) -out:pso_artool.exe $(OBJS) $(conlibs)
=======================================
--- /trunk/pso_tools/pso_artool/afs.c Fri Nov 21 04:00:56 2014 UTC
+++ /trunk/pso_tools/pso_artool/afs.c Sat Nov 22 06:23:30 2014 UTC
@@ -58,6 +58,8 @@
#ifdef _WIN32
/* In windows_compat.c */
char *basename(char *input);
+int my_rename(const char *old, const char *new);
+#define rename my_rename
#endif

static int digits(uint32_t n) {
=======================================
--- /trunk/pso_tools/pso_artool/gsl.c Fri Nov 21 05:08:38 2014 UTC
+++ /trunk/pso_tools/pso_artool/gsl.c Sat Nov 22 06:23:30 2014 UTC
@@ -61,6 +61,8 @@
#ifdef _WIN32
/* In windows_compat.c */
char *basename(char *input);
+int my_rename(const char *old, const char *new);
+#define rename my_rename
#endif

static int copy_file(FILE *dst, FILE *src, uint32_t size) {
=======================================
--- /trunk/pso_tools/pso_artool/windows_compat.c Wed Nov 19 19:43:59 2014
UTC
+++ /trunk/pso_tools/pso_artool/windows_compat.c Sat Nov 22 06:23:30 2014
UTC
@@ -117,7 +117,7 @@
v /= 62;
XXXXXX[5] = letters[v % 62];

- fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, 0600);
+ fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0600);
if (fd >= 0)
{
errno = save_errno;
@@ -139,6 +139,16 @@

_splitpath(input, NULL, NULL, output, ext);
strcat(output, ext);
+ return output;
+}
+
+/* Really? rename() won't overwrite existing files on Windows? */
+int my_rename(const char *old, const char *new) {
+ if(!MoveFileEx(old, new, MOVEFILE_REPLACE_EXISTING |
+ MOVEFILE_WRITE_THROUGH | MOVEFILE_COPY_ALLOWED))
+ return -1;
+
+ return 0;
}

#endif
Reply all
Reply to author
Forward
0 new messages