aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/logCompression.cpp
diff options
context:
space:
mode:
authorBarichello <artur@barichello.me>2022-02-17 18:07:10 -0300
committerBarichello <artur@barichello.me>2022-02-17 18:08:02 -0300
commite72564b27cef35e991ae90ac868c5718fa3bd122 (patch)
tree49cfbf34f11aa46400d24c26f63c8e8054d98ca6 /NorthstarDedicatedTest/logCompression.cpp
parentf3c8dba536329e2907e12b80f6774467d93779cf (diff)
downloadNorthstarLauncher-e72564b27cef35e991ae90ac868c5718fa3bd122.tar.gz
NorthstarLauncher-e72564b27cef35e991ae90ac868c5718fa3bd122.zip
Revert "Fix corrupted zipped logs (#76)"
This reverts commit 37212a4d0cb59929af6366b48d0a8cc110f06912. Reverting this in favor of deletion i guess
Diffstat (limited to 'NorthstarDedicatedTest/logCompression.cpp')
-rw-r--r--NorthstarDedicatedTest/logCompression.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/NorthstarDedicatedTest/logCompression.cpp b/NorthstarDedicatedTest/logCompression.cpp
index 5c170de3..d9e89fdf 100644
--- a/NorthstarDedicatedTest/logCompression.cpp
+++ b/NorthstarDedicatedTest/logCompression.cpp
@@ -17,6 +17,7 @@ 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);
@@ -30,13 +31,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
- ofstream output(filename + ".gz", ios::out | ios::binary);
- if (!output)
+ output.open(filename + ".gz");
+ if (!output.is_open())
{
cerr << "Could not write : '" + filename + "'" << endl;
return false;
}
- output.write(compressed_data.c_str(), compressed_data.size());
+ output << compressed_data;
output.close();
// delete log file
remove(path);