Byron Clark avatar Byron Clark committed 56ccc78

Only allow a single filter file.

With this change we also stop using the global xdg config directory.

Comments (0)

Files changed (1)

 import gobject
 import gio
 import pynotify
-import xdg.BaseDirectory
+from xdg.BaseDirectory import xdg_config_home
 import udiskie.device
 import udiskie.match
 class AutoMounter:
     CONFIG_PATH = 'udiskie/filters.conf'
-    def __init__(self, bus=None, filter_files=None):
+    def __init__(self, bus=None, filter_file=None):
         self.log = logging.getLogger('udiskie.mount.AutoMounter')
         self.last_device_state = {}
             self.bus = bus
-        if not filter_files:
-            base_paths = xdg.BaseDirectory.xdg_config_dirs
-            filter_files = [os.path.join(D, self.CONFIG_PATH) for D in base_paths]
-        self.filters = udiskie.match.FilterMatcher(filter_files)
+        if not filter_file:
+            filter_file = os.path.join(xdg_config_home, self.CONFIG_PATH)
+        self.filters = udiskie.match.FilterMatcher((filter_file,))
-    mounter = AutoMounter(bus=None, filter_files=options.filters)
+    mounter = AutoMounter(bus=None, filter_file=options.filters)
     return gobject.MainLoop().run()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.