Created
April 5, 2011 14:50
-
-
Save tomprince/903746 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 74d6b5415714124466278754fdbfbcc19c2a2c72 | |
Author: Tom Prince <[email protected]> | |
Date: Tue Apr 5 10:47:31 2011 -0400 | |
BIFImporter: Overwrite files in cache, when extracting save game. | |
Signed-off-by: Tom Prince <[email protected]> | |
diff --git a/gemrb/core/FileCache.cpp b/gemrb/core/FileCache.cpp | |
index 4d3724f..0be598d 100644 | |
--- a/gemrb/core/FileCache.cpp | |
+++ b/gemrb/core/FileCache.cpp | |
@@ -23,7 +23,7 @@ | |
#include "System/FileStream.h" | |
#include "System/VFS.h" | |
-DataStream* CacheCompressedStream(DataStream *stream, const char* filename, int length) | |
+DataStream* CacheCompressedStream(DataStream *stream, const char* filename, int length, bool overwrite) | |
{ | |
if (!core->IsAvailable(PLUGIN_COMPRESSION_ZLIB)) { | |
printf( "No Compression Manager Available.\nCannot Load Compressed File.\n" ); | |
@@ -35,7 +35,7 @@ DataStream* CacheCompressedStream(DataStream *stream, const char* filename, int | |
char path[_MAX_PATH]; | |
PathJoin(path, core->CachePath, fname, NULL); | |
- if (!file_exists(path)) { | |
+ if (overwrite || !file_exists(path)) { | |
FileStream out; | |
if (!out.Create(path)) { | |
printMessage("FileCache", " ", RED); | |
diff --git a/gemrb/core/FileCache.h b/gemrb/core/FileCache.h | |
index 7f4e246..1345a4a 100644 | |
--- a/gemrb/core/FileCache.h | |
+++ b/gemrb/core/FileCache.h | |
@@ -21,7 +21,7 @@ | |
#include "System/DataStream.h" | |
-GEM_EXPORT DataStream* CacheCompressedStream(DataStream *stream, const char* filename, int length = 0); | |
+GEM_EXPORT DataStream* CacheCompressedStream(DataStream *stream, const char* filename, int length = 0, bool overwrite = false); | |
GEM_EXPORT DataStream* CacheFile(const char* path); | |
#endif | |
diff --git a/gemrb/plugins/BIFImporter/BIFImporter.cpp b/gemrb/plugins/BIFImporter/BIFImporter.cpp | |
index 8bd0a5d..a185576 100644 | |
--- a/gemrb/plugins/BIFImporter/BIFImporter.cpp | |
+++ b/gemrb/plugins/BIFImporter/BIFImporter.cpp | |
@@ -71,7 +71,7 @@ int BIFImporter::DecompressSaveGame(DataStream *compressed) | |
compressed->ReadDword( &declen ); | |
compressed->ReadDword( &complen ); | |
printf( "Decompressing %s\n", fname ); | |
- DataStream* cached = CacheCompressedStream(compressed, fname, complen); | |
+ DataStream* cached = CacheCompressedStream(compressed, fname, complen, true); | |
free( fname ); | |
if (!cached) | |
return GEM_ERROR; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment