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
评论列表
文章目录