We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ea89d34 commit 8b81113Copy full SHA for 8b81113
src/extract-zlib.rb
@@ -3,10 +3,16 @@
3
module VBiosFinder
4
class Extract
5
def self.zlib file
6
- File.open file, "r:ASCII-8BIT" do |data|
7
- File.open "#{file}-zlib", "w:ASCII-8BIT" do |outdata|
8
- outdata.write Zlib::Inflate.inflate(data.read)
+ target = "#{file}-zlib"
+ begin
+ File.open file, "r:ASCII-8BIT" do |data|
9
+ File.open target, "w:ASCII-8BIT" do |outdata|
10
+ outdata.write Zlib::Inflate.inflate(data.read)
11
+ end
12
end
13
+ rescue Zlib::DataError
14
+ puts "wrong guess :(".colorize(:red)
15
+ FileUtils.rm target
16
17
18
0 commit comments