Bugs: Browse | Submit New | Admin

[#27735] rcov_save_aggregate_data fails because directory doesn't exist

Date:
2010-01-26 21:34
Priority:
3
Submitted By:
Gary Weaver (garysweaver)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
rcov_save_aggregate_data fails because directory doesn't exist

Detailed description
When running rcov-0.9.7.1-java (JRuby 1.4.0 compatible version of rcov-0.9.7.1), rcov_save_aggregate_data fails (in
bin/rcov) because the coverage directory does not exist yet when it tries to create the aggregate.data file in that
directory.

To fix this, I added the following line:
  FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(File.dirname(file))

So that the method looks like:
  def rcov_save_aggregate_data(file)
    require 'zlib'
    FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(File.dirname(file))
    Zlib::GzipWriter.open(file) do |f|
      Marshal.dump({:callsites => $rcov_callsite_analyzer, :coverage => $rcov_code_coverage_analyzer}, f)
    end
  end

Do you think that this fix should be included in rcov? I'm not sure what is happening to cause this to be required,
other than the coverage directory not existing.

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item