startup.py 文件源码

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

项目:persepolis 作者: persepolisdm 项目源码 文件源码
def checkstartup():
    # check if it is linux
    if os_type == "Linux" or os_type == "FreeBSD" or os_type == 'OpenBSD':
        # check if the startup exists
        if os.path.exists(home_address + "/.config/autostart/persepolis.desktop"):
            return True
        else:
            return False

    # check if it is mac
    elif os_type == "Darwin":
        # OS X
        if os.path.exists(home_address + "/Library/LaunchAgents/com.persepolisdm.plist"):
            return True
        else:
            return False

    # check if it is Windows
    elif os_type == "Windows":
        # try to open startup key and check persepolis value
        try:
            aKey = winreg.OpenKey(
                winreg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, winreg.KEY_ALL_ACCESS)
            startupvalue = winreg.QueryValueEx(aKey, 'persepolis')
            startup = True
        except WindowsError:
            startup = False

        # Close the connection
        winreg.CloseKey(aKey)

        # if the startup enabled or disabled
        if startup:
            return True
        if not startup:
            return False

# add startup file
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号