Skip to content

Commit

Permalink
✨ feat(ALL): 实现单实例检测
Browse files Browse the repository at this point in the history
 - 禁止启动多个NCD,这样会导致一些奇怪的问题出现
  • Loading branch information
HeartfeltJoy committed Sep 29, 2024
1 parent 862bee8 commit 19a6668
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import ctypes

# 第三方库导入
import psutil
from loguru import logger

# 项目内模块导入
Expand All @@ -18,6 +19,12 @@


if __name__ == "__main__":

# 检查是否已经有 NCD 在运行了, 如果有则取消运行
for proc in psutil.process_iter():
if proc.name() == "NapCat-Desktop.exe":
sys.exit()

# 调整程序 log 输出
Logger()
# 检查是否以管理员模式启动, 非管理员模式尝试获取管理员权限
Expand Down

0 comments on commit 19a6668

Please sign in to comment.