Skip to content

Commit

Permalink
CreateProgressCache仅尝试执行一次
Browse files Browse the repository at this point in the history
  • Loading branch information
Cnotech committed Jun 24, 2022
1 parent b6538f6 commit 8a80354
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flash-collector",
"version": "1.8.0",
"version": "1.9.0",
"main": "dist/main/index.cjs",
"author": "Cno <[email protected]>",
"license": "MPL-2.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/main/progress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ function validBackupJson(json: any): Result<null, string> {
}
}

//记录是否执行过CreateProgressCache
let launchedCreateProgressCache = false

function initProgressModule(noCreateProgressCache?: boolean): ProgressEnable {
let res: ProgressEnable = {
flashIndividual: false,
Expand All @@ -43,6 +46,7 @@ function initProgressModule(noCreateProgressCache?: boolean): ProgressEnable {
h5Import: false
}
let config = getConfig()
if (launchedCreateProgressCache) noCreateProgressCache = true
//判断flash
const SharedObjects = path.join(ROAMING_APPDATA, 'Macromedia', 'Flash Player', '#SharedObjects')
const CwdAppend = process.cwd().split('\\').slice(1).concat(['games', 'flash'])
Expand All @@ -61,6 +65,7 @@ function initProgressModule(noCreateProgressCache?: boolean): ProgressEnable {
}
//如果找不到进度则尝试调用示例swf文件创建一个进度,然后重试
if (!res.flashIndividual && !noCreateProgressCache) {
launchedCreateProgressCache = true
shelljs.mkdir("-p", path.join("games", "flash", "_FC_TEMP_"))
shelljs.cp(path.join("retinue", "createProgressCache.swf"), path.join("games", "flash", "_FC_TEMP_"))
cp.execSync(`"${path.join("retinue", "flashplayer_sa.exe")}" "${path.join("games", "flash", "_FC_TEMP_", "createProgressCache.swf")}"`)
Expand Down

0 comments on commit 8a80354

Please sign in to comment.