Commit 3dd4c8e0 by Jon Wood Committed by GitHub

Merge branch 'master' into master

parents af947faa 574ae9e4
...@@ -6,6 +6,7 @@ def locate_mime_database ...@@ -6,6 +6,7 @@ def locate_mime_database
(File.expand_path(ENV["FREEDESKTOP_MIME_TYPES_PATH"]) if ENV["FREEDESKTOP_MIME_TYPES_PATH"]), (File.expand_path(ENV["FREEDESKTOP_MIME_TYPES_PATH"]) if ENV["FREEDESKTOP_MIME_TYPES_PATH"]),
"/usr/local/share/mime/packages/freedesktop.org.xml", "/usr/local/share/mime/packages/freedesktop.org.xml",
"/opt/homebrew/share/mime/packages/freedesktop.org.xml", "/opt/homebrew/share/mime/packages/freedesktop.org.xml",
"/opt/local/share/mime/packages/freedesktop.org.xml",
"/usr/share/mime/packages/freedesktop.org.xml" "/usr/share/mime/packages/freedesktop.org.xml"
].compact ].compact
path = possible_paths.find { |candidate| File.exist?(candidate) } path = possible_paths.find { |candidate| File.exist?(candidate) }
...@@ -23,8 +24,10 @@ end ...@@ -23,8 +24,10 @@ end
desc "Build a file pointing at the database" desc "Build a file pointing at the database"
task :default do task :default do
mime_database_path = locate_mime_database mime_database_path = locate_mime_database
path_rb = File.expand_path("../../../lib/mimemagic/path.rb", __FILE__) target_dir = "#{ENV.fetch("RUBYARCHDIR")}/mimemagic"
open(path_rb, "w") do |f| mkdir_p target_dir
open("#{target_dir}/path.rb", "w") do |f|
f.print(<<~SOURCE f.print(<<~SOURCE
class MimeMagic class MimeMagic
DATABASE_PATH="#{mime_database_path}" DATABASE_PATH="#{mime_database_path}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment