Browse Source

If outfile is specified bin file should be named after it

Piotr Czajkowski 5 years ago
parent
commit
fee07f11ea
1 changed files with 6 additions and 3 deletions
  1. 6 3
      zip.c

+ 6 - 3
zip.c

@@ -59,14 +59,17 @@ int processDOCX(const char *infile, const char *outfile) {
 }
 
 int process(const char *infile, char *outfile) {
-	strcat(binnFile, infile);
-	strcat(binnFile, ".bin");
-
 	if (!outfile || strcmp(infile, outfile) == 0){
+		strcat(binnFile, infile);
+		strcat(binnFile, ".bin");
+
 		const char *outfile = "tmpFile.docx";
 		processDOCX(infile, outfile);
 		rename(outfile, infile);
 	} else {
+		strcat(binnFile, outfile);
+		strcat(binnFile, ".bin");
+
 		processDOCX(infile, outfile);
 	}
 	return 1;