Pārlūkot izejas kodu

Windows needs remove before rename

Czajkowski, Piotr 5 gadi atpakaļ
vecāks
revīzija
4e181234f0
1 mainītis faili ar 2 papildinājumiem un 0 dzēšanām
  1. 2 0
      zip.c

+ 2 - 0
zip.c

@@ -67,6 +67,7 @@ int anonymize(const char *infile, char *outfile) {
 
 		const char *outfile = "tmpFile.docx";
 		processDOCX(infile, outfile);
+		remove(infile);
 		rename(outfile, infile);
 	} else {
 		strcat(binnFile, outfile);
@@ -84,6 +85,7 @@ int deanonymize(const char *infile, char *outfile) {
 	if (!outfile || strcmp(infile, outfile) == 0){
 		const char *outfile = "tmpFile.docx";
 		processDOCX(infile, outfile);
+		remove(infile);
 		rename(outfile, infile);
 	} else {
 		processDOCX(infile, outfile);