fix:意外

This commit is contained in:
ikun
2024-09-05 21:27:36 +08:00
parent a7ce46aa52
commit 6ec83c4196
3 changed files with 26 additions and 2 deletions

22
common/migration.py Normal file
View File

@@ -0,0 +1,22 @@
import os
from common import log, getsteampath
from pathlib import Path
# 设置文件目录
log = log.log
steam_path = getsteampath.steam_path
directory = Path(steam_path / "config" / "stplug-in")
# 遍历目录中的所有文件
def migrate():
for filename in os.listdir(directory):
if filename.startswith("Onekey_unlock_"):
new_filename = filename[len("Onekey_unlock_"):]
old_file = os.path.join(directory, filename)
new_file = os.path.join(directory, new_filename)
os.rename(old_file, new_file)
log.info(f'Renamed: {filename} -> {new_filename}')
migrate = migrate

View File

@@ -11,7 +11,7 @@ steam_path = getsteampath.steam_path
# 增加SteamTools解锁相关文件
async def stool_add(depot_data, app_id):
lua_filename = f"Onekey{app_id}.lua"
lua_filename = f"{app_id}.lua"
lua_filepath = steam_path / "config" / "stplug-in" / lua_filename
async with lock:

View File

@@ -4,7 +4,7 @@ import aiofiles
import traceback
import time
import asyncio
from common import log, config, getsteampath, stunlock, glunlock, stack_error, manifestdown, dkey_merge
from common import log, config, getsteampath, stunlock, glunlock, stack_error, manifestdown, dkey_merge, migration
from aiohttp import ClientSession
from pathlib import Path
@@ -19,6 +19,7 @@ glunlock = glunlock.glunlock
stack_error = stack_error.stack_error
get = manifestdown.get
depotkey_merge = dkey_merge.depotkey_merge
migration = migration.migrate
print('\033[1;32;40m _____ __ _ _____ _ _ _____ __ __ ' + '\033[0m')
@@ -152,6 +153,7 @@ repos = [
]
if __name__ == '__main__':
try:
migration()
log.info('App ID可以在SteamDB或Steam商店链接页面查看')
app_id = input("请输入游戏AppID").strip()
asyncio.run(main(app_id))