about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorSamuli Thomasson <samuli.thomasson@paivola.fi>2020-09-11 21:04:48 +0200
committerSamuli Thomasson <samuli.thomasson@paivola.fi>2020-09-11 21:04:48 +0200
commit0a801333088e74c474b77a2af21a93727f072282 (patch)
treecbf515d0913beeeff82b50288aef36d133c1470e /ranger
parentf8b150f76b1cf06ea4e97e146545c8e3de02d809 (diff)
downloadranger-0a801333088e74c474b77a2af21a93727f072282.tar.gz
drop custom MimeTypes object in core.fm
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/fm.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/ranger/core/fm.py b/ranger/core/fm.py
index cef9394d..52cd83d6 100644
--- a/ranger/core/fm.py
+++ b/ranger/core/fm.py
@@ -73,11 +73,10 @@ class FM(Actions,  # pylint: disable=too-many-instance-attributes
         self.hostname = socket.gethostname()
         self.home_path = os.path.expanduser('~')
 
-        self.mimetypes = mimetypes.MimeTypes()
-        extra_files = [self.relpath('data/mime.types'), os.path.expanduser("~/.mime.types")]
-        for path in mimetypes.knownfiles + extra_files:
-            if os.path.isfile(path):
-                self.mimetypes.read(path)
+        if not mimetypes.inited:
+            extra_files = [self.relpath('data/mime.types'), os.path.expanduser("~/.mime.types")]
+            mimetypes.init(mimetypes.knownfiles + extra_files)
+        self.mimetypes = mimetypes
 
     def initialize(self):  # pylint: disable=too-many-statements
         """If ui/bookmarks are None, they will be initialized here."""