--- lib/File/MimeInfo.pm.orig	2020-10-26 13:02:01.000000000 -0700
+++ lib/File/MimeInfo.pm	2020-10-26 15:53:43.000000000 -0700
@@ -145,6 +145,19 @@
 sub rehash {
     (@globs, %literal, %extension, %mime2ext) = (); # clear all data
     local $_; # limit scope of $_ ... :S
+
+    ## setup @DIRS to point to the DB that MacPorts installed,
+    ## thus users don't have to set ENV vars and such.
+    my $DIRS_index = undef;
+    for ($DIRS_index = 0; $DIRS_index < @DIRS; $DIRS_index++) {
+        if ($DIRS[$DIRS_index] =~ m|__PREFIX__/share/mime|) {
+            last;
+        }
+    }
+    if ($DIRS_index >= @DIRS) {
+        ## we didn't find the MP prefix path, add it...
+        push @DIRS, '__PREFIX__/share/mime';
+    }
     my @globfiles = @DIRS
         ? ( grep {-e $_ && -r $_} map "$_/globs", @DIRS )
         : ( reverse data_files('mime/globs')        );
