mirror of
https://github.com/ikunshare/Onekey.git
synced 2026-01-12 16:25:53 +08:00
fix:意外
This commit is contained in:
22
common/migration.py
Normal file
22
common/migration.py
Normal 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
|
||||
@@ -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:
|
||||
|
||||
4
main.py
4
main.py
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user