- when extracting multiple files with the same name, put the counter in the extension, not the base part.

This way the output can mostly be reused as-is, when put in the base it'd require user intervention to correct things.
This commit is contained in:
Christoph Oelckers 2021-08-08 08:42:58 +02:00
parent 065708b4ea
commit 5eecfa5947

View file

@ -96,7 +96,7 @@ bool isPatch(const char * n)
nn[8] = 0; nn[8] = 0;
strupr(nn); strupr(nn);
for (int i = 0; i<*l; i++) for (unsigned i = 0; i<*l; i++)
{ {
if (!strncmp(c, nn, 8)) return true; if (!strncmp(c, nn, 8)) return true;
c += 8; c += 8;
@ -125,7 +125,7 @@ const char * MakeFileName(const char * base, const char * ext)
for(int i=0;;i++) for(int i=0;;i++)
{ {
if (i > 0) sprintf(buffer,"%s(%d)%s", basebuffer, i, ext); if (i > 0) sprintf(buffer,"%s%s(%d)", basebuffer, ext, i);
else sprintf(buffer, "%s%s", basebuffer, ext); else sprintf(buffer, "%s%s", basebuffer, ext);
strlwr(buffer); strlwr(buffer);
FILE *f = fopen(buffer, "rb"); FILE *f = fopen(buffer, "rb");