mirror of
https://github.com/yeongpin/cursor-free-vip.git
synced 2025-08-03 04:57:36 +08:00
refactor: Simplify Admin Privilege Request Logic
- Consolidate admin privilege request logic for Windows by removing redundant checks for frozen executables
This commit is contained in:
parent
68b1dae466
commit
a67264d5c2
9
main.py
9
main.py
@ -58,13 +58,8 @@ def run_as_admin():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if is_frozen():
|
args = [sys.executable] + sys.argv
|
||||||
# If frozen executable
|
|
||||||
args = [sys.executable] + sys.argv
|
|
||||||
else:
|
|
||||||
# If Python script
|
|
||||||
args = [sys.executable] + sys.argv
|
|
||||||
|
|
||||||
# Request elevation via ShellExecute
|
# Request elevation via ShellExecute
|
||||||
print(f"{Fore.YELLOW}{EMOJI['ADMIN']} Requesting administrator privileges...{Style.RESET_ALL}")
|
print(f"{Fore.YELLOW}{EMOJI['ADMIN']} Requesting administrator privileges...{Style.RESET_ALL}")
|
||||||
ctypes.windll.shell32.ShellExecuteW(None, "runas", args[0], " ".join('"' + arg + '"' for arg in args[1:]), None, 1)
|
ctypes.windll.shell32.ShellExecuteW(None, "runas", args[0], " ".join('"' + arg + '"' for arg in args[1:]), None, 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user