X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=lib%2Fredact%2Fapp.rb;h=2cc9dd7cf74b7022948a0d207380bb08127c32ab;hb=32110b209dd3a39fc9e36b83ba830a9172ad6c15;hp=72175162e2424c86930db4166b8ab19d9c30246a;hpb=fbe0312c3804c1283cb9f767e481a4db128e299d;p=redact.git diff --git a/lib/redact/app.rb b/lib/redact/app.rb index 7217516..2cc9dd7 100644 --- a/lib/redact/app.rb +++ b/lib/redact/app.rb @@ -1,5 +1,5 @@ #-- -# $Id: app.rb 7 2005-03-28 16:27:18Z tilman $ +# $Id: app.rb 40 2005-05-25 20:19:45Z tilman $ # # Copyright (c) 2005 Tilman Sauerbeck (tilman at code-monkey de) # @@ -66,15 +66,20 @@ module Redact amx = compile_embryo - Eet::File.open(@options.output, "w") do |ef| - dump_amx(amx, ef) - - dump_header(ef) - dump_collections(ef) - dump_fonts(ef) - dump_images(ef) - dump_source(ef) - dump_fontmap(ef) + begin + Eet::File.open(@options.output, "w") do |ef| + dump_amx(amx, ef) + + dump_header(ef) + dump_collections(ef) + dump_fonts(ef) + dump_images(ef) + dump_source(ef) + dump_fontmap(ef) + end + rescue Exception + File.rm_f(@options.output) + raise end end @@ -135,7 +140,8 @@ module Redact c = "embryo_cc " + "-i #{incl}/include " + "-o #{tf_out.path} #{tf_in.path}" - unless system(c) + system(c) + unless (0..1).include?($?.exitstatus) raise("Cannot compile Embryo code") end @@ -206,7 +212,7 @@ EOT method = (sane == @filename) ? :unshift : :push s.send(method, SourceFile.new(sane, value.join)) - # include files that are with File.read, too + # include files that are read with File.read, too value.join.grep(/File\.read\(\"(.+)\"\)/) do sane = Pathname.new($1).cleanpath.to_s s << SourceFile.new(sane, File.read(sane))