Skip to content

Instantly share code, notes, and snippets.

@tliff
Created April 23, 2012 10:24
Show Gist options
  • Save tliff/2470120 to your computer and use it in GitHub Desktop.
Save tliff/2470120 to your computer and use it in GitHub Desktop.
require 'rexml/document'
require 'pp'
if ARGV.size != 1
puts "Usage: ruby fix.rb PROFILEBASEDIR"
end
Dir.glob("#{ARGV[0]}/**/mimeTypes.rdf").each do |p|
puts "Processing p"
buffer = ""
doc = REXML::Document.new(File.new(p))
element = REXML::XPath.first(doc, '//RDF:Description[@RDF:about="urn:mimetype:externalApplication:application/pdf"]')
element.attributes["NC:Path"] = 'C:\Programme\Adobe\Reader 10.0\Reader\AcroRd32.exe'
doc.write(buffer)
File.open(p, 'w') do |f|
f.write(buffer)
end
end
puts "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment