From 26675dd3b2ba8c3da08e993362e80b8351aa4c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20=C5=9Awi=C4=85tkowski?= Date: Sat, 27 Mar 2021 02:40:17 +0100 Subject: [PATCH] Support Windows --- README.md | 11 +++++++++++ ext/mimemagic/Rakefile | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f5ef301..f1f47fc 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,17 @@ Place the file `freedesktop.org.xml` in an appropriate location, and then set th `FREEDESKTOP_MIME_TYPES_PATH` to that path. Once that has been done the gem should install successfully. Please note that the gem will depend upon the file remaining in that location at run time. +For Windows +=============== + +This was tested in Ruby installed via Ruby Installer, but should work for other methods too. + +1. Download 7-Zip from https://www.7-zip.org/download.html +2. Download the package from https://packages.debian.org/sid/amd64/shared-mime-info/download +3. Unzip the file in `data.tar\.\usr\share\mime\packages\freedesktop.org.xml` somewhere, for the purpose of this tutorial assuming C:\shared-mime-info +4. In command line, export environment variable: `set FREEDESKTOP_MIME_TYPES_PATH=C:\shared-mime-info\freedesktop.org.xml` +5. Install the gem via `bundle install` or `gem install mimemagic` + Usage ===== diff --git a/ext/mimemagic/Rakefile b/ext/mimemagic/Rakefile index f0474bf..a4e39d2 100644 --- a/ext/mimemagic/Rakefile +++ b/ext/mimemagic/Rakefile @@ -24,7 +24,7 @@ end desc "Build a file pointing at the database" task :default do mime_database_path = locate_mime_database - target_dir = "#{ENV.fetch("RUBYARCHDIR", "../lib")}/mimemagic" + target_dir = File.join(ENV.fetch("RUBYARCHDIR", "../lib"), "mimemagic") mkdir_p target_dir open("#{target_dir}/path.rb", "w") do |f|