Skip to content

Commit

Permalink
Support Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
katafrakt committed Mar 27, 2021
1 parent af5a9b1 commit e6c5a7b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
=====

Expand Down
2 changes: 1 addition & 1 deletion ext/mimemagic/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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(RbConfig::CONFIG['rubyarchdir'] || "../lib", "mimemagic")
mkdir_p target_dir

open("#{target_dir}/path.rb", "w") do |f|
Expand Down

0 comments on commit e6c5a7b

Please sign in to comment.