def on_remove_button(self):
     path = self.list_view.get_item(self.list_view.get_index())
     search_path = LauncherSettings.get("search_path")
     search_path = [x.strip() for x in search_path.split(";") if x.strip()]
     for i in range(len(search_path)):
         if search_path[i].startswith("-"):
             if path == search_path[i][1:]:
                 # Already removed.
                 break
         else:
             if search_path[i] == path:
                 search_path.remove(search_path[i])
                 break
     default_paths = FSGSDirectories.get_default_search_path()
     if path in default_paths:
         search_path.append("-" + path)
     LauncherSettings.set("search_path", ";".join(search_path))
 def on_add_button(self):
     search_path = LauncherSettings.get("search_path")
     search_path = [x.strip() for x in search_path.split(";") if x.strip()]
     path = fsui.pick_directory(parent=self.get_window())
     if path:
         for i in range(len(search_path)):
             if search_path[i].startswith("-"):
                 if path == search_path[i][1:]:
                     search_path.remove(search_path[i])
                     break
             else:
                 if search_path[i] == path:
                     # Already added.
                     break
         else:
             default_paths = FSGSDirectories.get_default_search_path()
             if path not in default_paths:
                 search_path.append(path)
         LauncherSettings.set("search_path", ";".join(search_path))
 def get_search_path(cls):
     paths = FSGSDirectories.get_default_search_path()
     search_path = LauncherSettings.get("search_path")
     for p in search_path.split(";"):
         p = p.strip()
         if not p:
             continue
         elif p[0] == "-":
             p = p[1:]
             if p in paths:
                 paths.remove(p)
         else:
             if p not in paths:
                 paths.append(p)
     # The Configurations dir is always scanned on startup (whenever
     # modification time has changed). If we don't include it here too
     # always, the result will be that the configs sometimes appear (on
     # startup) and disappear (on scan).
     if not FSGSDirectories.get_configurations_dir() in paths:
         paths.append(FSGSDirectories.get_configurations_dir())
     # Likewise, we force the Kickstarts directory to always be scanned.
     if not FSGSDirectories.get_kickstarts_dir() in paths:
         paths.append(FSGSDirectories.get_kickstarts_dir())
     return paths