fix: path matching fails when the game is installed in the root directory

This commit is contained in:
mio 2023-05-01 17:04:04 +08:00
parent bfa075fe57
commit 5de6b7bb6a
2 changed files with 2 additions and 2 deletions

@ -1,6 +1,6 @@
{
"name": "star-rail-warp-export",
"version": "0.0.2",
"version": "0.0.3",
"main": "./dist/electron/main/main.js",
"author": "biuuu <https://github.com/biuuu>",
"license": "MIT",

@ -115,7 +115,7 @@ const readLog = async () => {
}
const promises = logPaths.map(async logpath => {
const logText = await fs.readFile(logpath, 'utf8')
const gamePathMch = logText.match(/\w:\/.+(Star\sRail\/Game\/StarRail_Data)/)
const gamePathMch = logText.match(/\w:\/.*?(Star\sRail\/Game\/StarRail_Data)/)
if (gamePathMch) {
const cacheText = await fs.readFile(path.join(gamePathMch[0], '/webCaches/Cache/Cache_Data/data_2'), 'utf8')
const urlMch = cacheText.match(/https.+?&auth_appid=webview_gacha&.+?authkey=.+?&game_biz=hkrpg_.+/g)