This repository has been archived by the owner on Dec 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from muwenyan521/main
更改外观,增加功能
- Loading branch information
Showing
4 changed files
with
200 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
import winreg | ||
|
||
from pathlib import Path | ||
|
||
def get_steam_path(): | ||
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Valve\Steam') | ||
steam_path = Path(winreg.QueryValueEx(key, 'SteamPath')[0]) | ||
return steam_path | ||
|
||
steam_path = get_steam_path() | ||
try: | ||
with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\Valve\Steam') as key: | ||
steam_path = Path(winreg.QueryValueEx(key, 'SteamPath')[0]) | ||
return steam_path | ||
except FileNotFoundError: | ||
print("未找到 Steam 安装路径,请确保 Steam 已安装。") | ||
return None | ||
except Exception as e: | ||
print(f"发生错误: {e}") | ||
return None | ||
|
||
steam_path = get_steam_path() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters