def get_user_dir(): """Place where QL saves its state, database, config etc.""" if os.name == "nt": USERDIR = os.path.join(windows.get_appdata_dir(), "Quod Libet") elif is_osx(): USERDIR = os.path.join(os.path.expanduser("~"), ".quodlibet") else: USERDIR = os.path.join(xdg_get_config_home(), "quodlibet") if not os.path.exists(USERDIR): tmp = os.path.join(os.path.expanduser("~"), ".quodlibet") if os.path.exists(tmp): USERDIR = tmp if 'QUODLIBET_USERDIR' in environ: USERDIR = environ['QUODLIBET_USERDIR'] if build.BUILD_TYPE == u"windows-portable": USERDIR = os.path.normpath( os.path.join(os.path.dirname(path2fsn(sys.executable)), "..", "..", "config")) # XXX: users shouldn't assume the dir is there, but we currently do in # some places mkdir(USERDIR, 0o750) return USERDIR
def get_user_dir(): """Place where QL saves its state, database, config etc.""" if os.name == "nt": USERDIR = os.path.join(windows.get_appdata_dir(), "Quod Libet") elif is_osx(): USERDIR = os.path.join(os.path.expanduser("~"), ".quodlibet") else: USERDIR = os.path.join(xdg_get_config_home(), "quodlibet") if not os.path.exists(USERDIR): tmp = os.path.join(os.path.expanduser("~"), ".quodlibet") if os.path.exists(tmp): USERDIR = tmp if 'QUODLIBET_USERDIR' in environ: USERDIR = environ['QUODLIBET_USERDIR'] if build.BUILD_TYPE == u"windows-portable": USERDIR = os.path.normpath(os.path.join( os.path.dirname(path2fsn(sys.executable)), "..", "..", "config")) # XXX: users shouldn't assume the dir is there, but we currently do in # some places mkdir(USERDIR, 0o750) return USERDIR
def get_gtk_bookmarks(): """A list of paths from the GTK+ bookmarks. The paths don't have to exist. Returns: List[fsnative] """ if os.name == "nt": return [] path = os.path.join(xdg_get_config_home(), "gtk-3.0", "bookmarks") folders = [] try: with open(path, "rb") as f: folders = parse_gtk_bookmarks(f.read()) except (EnvironmentError, ValueError): pass return folders
def get_gtk_bookmarks(): """A list of paths from the GTK+ bookmarks. The paths don't have to exist. Returns: List[fsnative] """ if os.name == "nt": return [] path = os.path.join(xdg_get_config_home(), "gtk-3.0", "bookmarks") folders = [] try: with open(path, "rb") as f: folders = parse_gtk_bookmarks(f.read()) except (EnvironmentError, ValueError): pass return folders
def test_on_windows(self): self.assertTrue(xdg_get_system_data_dirs()) self.assertTrue(xdg_get_cache_home()) self.assertTrue(xdg_get_data_home()) self.assertTrue(xdg_get_config_home())
def test_on_windows(self): self.assertTrue(xdg_get_system_data_dirs()) self.assertTrue(xdg_get_cache_home()) self.assertTrue(xdg_get_data_home()) self.assertTrue(xdg_get_config_home())