mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-27 17:06:49 +00:00
Port bsatool
This commit is contained in:
parent
8410966753
commit
460304b069
1 changed files with 6 additions and 4 deletions
|
@ -237,12 +237,14 @@ int extract(Bsa::BSAFile& bsa, Arguments& info)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a stream for the file to extract
|
// 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);
|
bfs::ofstream out(target, std::ios::binary);
|
||||||
|
|
||||||
// Write the file to disk
|
// Write the file to disk
|
||||||
std::cout << "Extracting " << info.extractfile << " to " << target << std::endl;
|
std::cout << "Extracting " << info.extractfile << " to " << target << std::endl;
|
||||||
out.write(data->getAsString().c_str(), data->size());
|
|
||||||
|
out << stream->rdbuf();
|
||||||
out.close();
|
out.close();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -276,12 +278,12 @@ int extractAll(Bsa::BSAFile& bsa, Arguments& info)
|
||||||
|
|
||||||
// Get a stream for the file to extract
|
// Get a stream for the file to extract
|
||||||
// (inefficient because getFile iter on the list again)
|
// (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);
|
bfs::ofstream out(target, std::ios::binary);
|
||||||
|
|
||||||
// Write the file to disk
|
// Write the file to disk
|
||||||
std::cout << "Extracting " << target << std::endl;
|
std::cout << "Extracting " << target << std::endl;
|
||||||
out.write(data->getAsString().c_str(), data->size());
|
out << data->rdbuf();
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue