Skip to content

Commit 6d4a368

Browse files
committed
feat:automatically delete old PE resources
1 parent 1c78367 commit 6d4a368

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

resources/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"api":{"api":"https://api.hotpe.top/","ghapi":"http://ghapi.hotpe.top/","dl":"http://p0.hotpe.top/"},"state":{"install":"noDown","resUpdate":"without","setupToSys":"without"},"environment":{"HotPEDrive":{"new":{"diskIndex":-1,"letter":"","isMove":false,"version":""},"all":[]},"ware":{"system":{"os":"","buildNumber":"","userName":"","architecture":"","firmware":""},"disks":[]}},"resources":{"pe":{"new":"","all":[],"update":{"id":"","name":"","description":"","url":"","date":""}},"client":{"new":"","all":[],"update":{"id":"","name":"","description":"","url":"","date":""}}},"directory":{},"notice":{"show":false,"type":"info","content":""},"download":{"thread":16},"setting":{"pe":{"bootWaitTime":3}}}

src/view/controller/condition.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const fs = window.require('fs')
33

44
import { config, roConfig } from "../services/config";
55
import { runCmdAsync } from "../utils/command";
6-
import { isHotPEDrive, traverseFiles, readHotPEConfig } from "../utils/utils"
6+
import { isHotPEDrive, traverseFiles, readHotPEConfig, delFiles } from "../utils/utils"
77
import { getHardwareInfo } from "../utils/hardwareInfo"
88
import { getEnvironment, updateState } from "./init";
99
import { checkHPMFiles } from "./hpm/checkHpmFiles";
@@ -20,6 +20,15 @@ export async function checkPERes() {
2020
} else {
2121
config.resources.pe.new = ''
2222
}
23+
24+
//删除旧的PE资源
25+
for (let i in config.resources.pe.all) {
26+
if (config.resources.pe.all[i] != config.resources.pe.new) {
27+
await delFiles(roConfig.path.resources.pe + config.resources.pe.all[i])
28+
config.resources.pe.all.splice(i, 0)
29+
}
30+
}
31+
2332
}
2433

2534
//检查本地的PE
@@ -59,10 +68,10 @@ export async function checkPEDrive() {
5968
if (partition.letter != '') {
6069
if (isHotPEDrive(partition.letter)) {
6170
let HotPEDriveInfoTemp = { diskIndex: disk.index, letter: partition.letter, isMove: disk.type == 'USB', version: readHotPEConfig(partition.letter).information.ReleaseVersion }
62-
if(!config.environment.HotPEDrive.all.includes(HotPEDriveInfoTemp)){
71+
if (!config.environment.HotPEDrive.all.includes(HotPEDriveInfoTemp)) {
6372
config.environment.HotPEDrive.all.push(HotPEDriveInfoTemp)
6473
}
65-
74+
6675

6776
//判断是否为系统安装的PE
6877
if (partition.letter == roConfig.environment.sysLetter) {

src/view/page/Home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export default function Home(props: any) {
169169

170170

171171
return (
172-
<div style={{ padding: '24px', height: '100%' }}>
172+
<div style={{ padding: '24px', height: 'calc(100% - 48px)' }}>
173173

174174
<div style={{ width: '100%', display: 'flex', whiteSpace: 'nowrap' }}>
175175
<div style={{ width: 'calc(100% - 150px)' }}> {welcomeStr != '' ? <h2>{welcomeStr}</h2> : <></>}</div>

0 commit comments

Comments
 (0)