Procházet zdrojové kódy

Added some error checking.

Christopher Reed před 12 roky
rodič
revize
e306cc57f1
1 změnil soubory, kde provedl 3 přidání a 3 odebrání
  1. 3 3
      Tools/Contents/polybuild/Source/polybuild.cpp

+ 3 - 3
Tools/Contents/polybuild/Source/polybuild.cpp

@@ -89,9 +89,9 @@ uLong filetime(
 }
 }
 
 
 extern "C" int MyWriter(lua_State *L, const void *p, size_t sz, void *ud) {
 extern "C" int MyWriter(lua_State *L, const void *p, size_t sz, void *ud) {
-	zipWriteInFileInZip(static_cast<zipFile>(ud), p, sz);
+	int err = zipWriteInFileInZip(static_cast<zipFile>(ud), p, sz);
 	// Non 0 means an error and stops lua_dump from calling the writer again.
 	// Non 0 means an error and stops lua_dump from calling the writer again.
-	return 0;
+	return (err != ZIP_OK) && (sz != 0) ? 1 : 0;
 }
 }
 
 
 void addFileToZip(zipFile z, String filePath, String pathInZip, bool silent) {
 void addFileToZip(zipFile z, String filePath, String pathInZip, bool silent) {
@@ -120,7 +120,7 @@ void addFileToZip(zipFile z, String filePath, String pathInZip, bool silent) {
 		}
 		}
 		if(L) lua_close(L);
 		if(L) lua_close(L);
 		if(err) {
 		if(err) {
-			printf("Error compiling script. Ignoring.");
+			printf("Error compiling script. Ignoring.\n");
 		}
 		}
 	} else {
 	} else {
 		FILE *f = fopen(filePath.c_str(), "rb");
 		FILE *f = fopen(filePath.c_str(), "rb");