コード例 #1
0
ファイル: _main.py プロジェクト: weblate/quodlibet
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
コード例 #2
0
ファイル: _main.py プロジェクト: zsau/quodlibet
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
コード例 #3
0
ファイル: filesel.py プロジェクト: socialpercon/quodlibet
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
コード例 #4
0
ファイル: filesel.py プロジェクト: LudoBike/quodlibet
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
コード例 #5
0
ファイル: test_util.py プロジェクト: ptitjes/quodlibet
 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())
コード例 #6
0
ファイル: test_util.py プロジェクト: Muges/quodlibet
 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())