aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/logCompression.cpp
diff options
context:
space:
mode:
authorLegonzaur <34353603+Legonzaur@users.noreply.github.com>2022-02-16 13:16:32 +0100
committerGitHub <noreply@github.com>2022-02-16 09:16:32 -0300
commit37212a4d0cb59929af6366b48d0a8cc110f06912 (patch)
tree962c5a38621f94359787e677065131920158c198 /NorthstarDedicatedTest/logCompression.cpp
parent0faa9cfb3a9015ca723f012ca84609f602c7c03c (diff)
downloadNorthstarLauncher-37212a4d0cb59929af6366b48d0a8cc110f06912.tar.gz
NorthstarLauncher-37212a4d0cb59929af6366b48d0a8cc110f06912.zip
Fix corrupted zipped logs (#76)
Co-authored-by: Nathan TIEN YOU <nathan.tienyou@viacesi.fr>
Diffstat (limited to 'NorthstarDedicatedTest/logCompression.cpp')
-rw-r--r--NorthstarDedicatedTest/logCompression.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/NorthstarDedicatedTest/logCompression.cpp b/NorthstarDedicatedTest/logCompression.cpp
index d9e89fdf..5c170de3 100644
--- a/NorthstarDedicatedTest/logCompression.cpp
+++ b/NorthstarDedicatedTest/logCompression.cpp
@@ -17,7 +17,6 @@ using namespace std;
bool compressFile(const fs::path path)
{
// read log file
- ofstream output;
string filename(path.string());
cout << "Compressing : '" + filename + "'" << endl;
ifstream input(filename, ios_base::binary);
@@ -31,13 +30,13 @@ bool compressFile(const fs::path path)
// compress log file
string compressed_data = gzip::compress(log_data.data(), log_data.size());
// write log file gzip
- output.open(filename + ".gz");
- if (!output.is_open())
+ ofstream output(filename + ".gz", ios::out | ios::binary);
+ if (!output)
{
cerr << "Could not write : '" + filename + "'" << endl;
return false;
}
- output << compressed_data;
+ output.write(compressed_data.c_str(), compressed_data.size());
output.close();
// delete log file
remove(path);