i3keybinds.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:i3-used-keybinds 作者: AndrewOlsen 项目源码 文件源码
def find_config():
    '''Find the i3 config file in either
    ${HOME}/.i3/config or ${HOME}/.config/i3
    Exit if not found.
    '''
    if args.verbose:
        print('Searching for i3 config file....')
        print('Looking in .i3 ...')
    homedir = str(Path.home())
    doti3 = homedir + '/.i3/config'
    dotconfig = homedir + '/.config/i3/config'
    config = Path(doti3)
    if (config.is_file()):
        if args.verbose:
            print('Found .i3/config!')
        return config
    else:
        if args.verbose:
            print('File not found. Trying another directory.')
        config = Path(dotconfig)
        if (config.is_file()):
            if args.verbose:
                print('Found .config/i3/config!')
            return config
        else:
            print('No config files found.')
            print('Please make sure the file is in ~/.i3 or ~/.config')
            sys.exit(1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号