@@ -3,7 +3,7 @@ import { config, roConfig } from "../../services/config"
33import { runCmdAsync } from "../../utils/command"
44import { copyDir , copyFile , delDir , delFiles , getUsableLetter , isHotPEDrive , letterIsExist , moveFiles , readHotPEConfig , takeLeftStr , unZipFile , writeHotPEConfig } from "../../utils/utils"
55import { checkPEDrive } from "../condition"
6- import { checkIsReady } from "./check"
6+ import { checkIsReady , getHotPEDriveLetter } from "./check"
77import { ReactNode } from "react"
88const fs = window . require ( 'fs' )
99
@@ -206,8 +206,6 @@ export async function updatePEForUDisk(diskIndex: string, setStep: Function, set
206206 setStepStr ( '正在解压文件' )
207207 await unZipFile ( roConfig . path . resources . pe + config . resources . pe . new , tempPath )
208208
209-
210-
211209 setStep ( 1 )
212210
213211 //清理EFI分区
@@ -221,25 +219,31 @@ export async function updatePEForUDisk(diskIndex: string, setStep: Function, set
221219 isSucceed = isSucceed && await runPacmd ( ' /hd:' + diskIndex + ' /whide:1 /src:' + roConfig . path . execDir + tempEFIPath . substring ( 2 , tempEFIPath . length - 1 ) ) //去路径末'\'
222220
223221 setStepStr ( '正在更新数据分区' )
222+ let dataLetter = getHotPEDriveLetter ( Number ( diskIndex ) )
223+
224+ //let dataLetter = (await getUsableLetter() as string).substring(0, 2)
225+ //await runPacmd(' /hd:' + diskIndex + ' /setletter:0 /letter:' + dataLetter)
226+ if ( dataLetter != '' ) {
227+ //if (await letterIsExist(dataLetter)) {
228+ //复制数据区文件
229+ await copyDir ( tempDataPath , dataLetter + '\\' )
230+
231+ //pe配置文件
232+ let HotPEConfig = readHotPEConfig ( dataLetter + '\\' )
233+ HotPEConfig . information . Installation_Method = 'UDisk'
234+ HotPEConfig . information . ReleaseVersion = takeLeftStr ( config . resources . pe . new , '.' )
235+ writeHotPEConfig ( dataLetter + '\\' , HotPEConfig )
236+
237+ await runCmdAsync ( 'attrib ' + dataLetter + '\\HotPE +S +H /S /D' )
238+ await runCmdAsync ( 'attrib ' + dataLetter + '\\HotPE\\* +S +H /S /D' )
239+ await runCmdAsync ( 'attrib ' + dataLetter + '\\AUTORUN.INF +S +H /S /D' )
240+ await runCmdAsync ( 'attrib ' + dataLetter + '\\HotPE.ico +S +H /S /D' )
241+ //}
242+ } else {
243+ isSucceed = isSucceed && false
244+ }
224245
225- let dataLetter = ( await getUsableLetter ( ) as string ) . substring ( 0 , 2 )
226- await runPacmd ( ' /hd:' + diskIndex + ' /setletter:0 /letter:' + dataLetter )
227-
228- //if (await letterIsExist(dataLetter)) {
229- //复制数据区文件
230- await copyDir ( tempDataPath , dataLetter + '\\' )
231-
232- //pe配置文件
233- let HotPEConfig = readHotPEConfig ( dataLetter + '\\' )
234- HotPEConfig . information . Installation_Method = 'UDisk'
235- HotPEConfig . information . ReleaseVersion = takeLeftStr ( config . resources . pe . new , '.' )
236- writeHotPEConfig ( dataLetter + '\\' , HotPEConfig )
237246
238- await runCmdAsync ( 'attrib ' + dataLetter + '\\HotPE +S +H /S /D' )
239- await runCmdAsync ( 'attrib ' + dataLetter + '\\HotPE\\* +S +H /S /D' )
240- await runCmdAsync ( 'attrib ' + dataLetter + '\\AUTORUN.INF +S +H /S /D' )
241- await runCmdAsync ( 'attrib ' + dataLetter + '\\HotPE.ico +S +H /S /D' )
242- //}
243247
244248 setStep ( 2 )
245249 setStepStr ( '正在清理退出' )
0 commit comments