jadによる一括変換スクリプト

いちいち階層を変えて変換するのがめんどくさいので。
気になるところは色々ありますが・・・。

def generate(path)
    cache = {}
    Dir.open(path).each {|file|
        if file == "." || file == ".."
            next;
        end
        
        target_path = path + "/" + file;
        if File.directory?(target_path)
            begin
               generate(target_path)
            rescue
            end
        else
            if cache[path] == nil
               Dir.chdir(path)
               `jad  -s .java *.class`
               `del *.class`
               cache[path] = "true"
            end
        end
    }
end

def jad
    generate(Dir.pwd)
end

jad