From 460304b0697b96dc58a75ce7ecaf19de61031364 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 22 Apr 2015 18:06:29 +0200 Subject: [PATCH] Port bsatool --- apps/bsatool/bsatool.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/bsatool/bsatool.cpp b/apps/bsatool/bsatool.cpp index c0a6dcc81..2ea736db7 100644 --- a/apps/bsatool/bsatool.cpp +++ b/apps/bsatool/bsatool.cpp @@ -237,12 +237,14 @@ int extract(Bsa::BSAFile& bsa, Arguments& info) } // Get a stream for the file to extract - Ogre::DataStreamPtr data = bsa.getFile(archivePath.c_str()); + Files::IStreamPtr stream = bsa.getFile(archivePath.c_str()); + bfs::ofstream out(target, std::ios::binary); // Write the file to disk std::cout << "Extracting " << info.extractfile << " to " << target << std::endl; - out.write(data->getAsString().c_str(), data->size()); + + out << stream->rdbuf(); out.close(); return 0; @@ -276,12 +278,12 @@ int extractAll(Bsa::BSAFile& bsa, Arguments& info) // Get a stream for the file to extract // (inefficient because getFile iter on the list again) - Ogre::DataStreamPtr data = bsa.getFile(archivePath); + Files::IStreamPtr data = bsa.getFile(archivePath); bfs::ofstream out(target, std::ios::binary); // Write the file to disk std::cout << "Extracting " << target << std::endl; - out.write(data->getAsString().c_str(), data->size()); + out << data->rdbuf(); out.close(); }