undefined->使用python内置函数获取系统盘符

This commit is contained in:
cxykevin 2024-02-12 12:37:56 +08:00
parent d605c89fed
commit 70b0c6792f
1 changed files with 2 additions and 6 deletions

View File

@ -59,19 +59,15 @@ try:
sys.stdout.write("\033[0m\033[?25h\n\n\n")
# 搜索磁盘和用户名
sysdrive = "X:"
if not os.path.exists(sysdrive+"\\"):
sysdrive = "C:"
sysdrive = os.getenv("SystemDrive")
username = "Default"
for i in os.listdir(f"{sysdrive}\\Users"):
if i not in ("Default", "Default User", "Public", "All Users") and not os.path.isfile(f"{sysdrive}\\Users\\{i}"):
username = i
# 等待
while 1:
while not os.path.exists(f"{sysdrive}\\Users\\{username}\\Desktop"):
time.sleep(1)
if os.path.exists(f"{sysdrive}\\Users\\{username}\\Desktop"):
break
# 加载
log.info("load action \"onload\"")