This commit is contained in:
Artur Tretiak 2019-01-12 14:14:21 +02:00 committed by GitHub
parent d003f27518
commit 6acd49a94a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,11 +56,11 @@ def checkPermissions():
if os.getuid() == 0: if os.getuid() == 0:
print("{0}Permissions granted!".format(GREEN)) print("{0}Permissions granted!".format(GREEN))
else: else:
print("{0}If possible!! Please run as sudo !!".format(RED)) raise PermissionError("{0}Permissions denied! Please run as '{1}sudo{0}'".format(RED, GREEN))
elif systemos() == 'Windows': elif systemos() == 'Windows':
if ctypes.windll.shell32.IsUserAnAdmin() != 0: if ctypes.windll.shell32.IsUserAnAdmin() != 0:
print("{0}Permissions granted!".format(GREEN)) print("{0}Permissions granted!".format(GREEN))
else: else:
print("{0}If possible! Please run as administrator!".format(RED)) raise PermissionError("{0}Permissions denied! Please run as Administrator".format(RED))
else: else:
raise PermissionError("{0}Permissions denied! Unexpected platform".format(RED)) raise PermissionError("{0}Permissions denied! Unexpected platform".format(RED))