Repository navigation
补全组件:系统镜像没有 KeyHashes 时不再抛异常,校验出错写进日志 - #121
Merged
Merged
Conversation
fetch-components.ps1 开着 StrictMode 2,Test-ComponentFiles 用 $C.KeyHashes 判断要不要比哈希;
系统镜像那一项没有这个键,取值抛异常、被 catch 吞掉,系统镜像的校验永远不过。
改成 $C.ContainsKey('KeyHashes');catch 里把异常写进 fetch-components.log。
Refs ModAVD#118
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修 #118:0.37.0–0.38.0 的「补全组件.bat」第一次装系统镜像必然失败,报「解压后的关键文件或版本校验失败」。
原因
package/fetch-components.ps1开着Set-StrictMode -Version 2。Test-ComponentFiles用if ($C.KeyHashes)判断要不要比哈希。组件表里只有平台工具有这个键,系统镜像那一项没有。严格模式下取哈希表里不存在的键会抛PropertyNotFoundException(Windows PowerShell 5.1 和 pwsh 7 都一样)。catch { return $false }吞掉了,所以系统镜像的校验永远不过。四个关键文件其实都在,大小也对。改了什么
只改这一个文件的两处,别的不动:
if ($C.ContainsKey('KeyHashes'))。平台工具照旧核对钉住的哈希和版本号,系统镜像照旧只核对关键文件。catch里先把异常写进logs\fetch-components.log(「校验 <组件> 时出错:<原因>」),再照旧返回不齐全。以后再出这类问题,日志里能看到原因。文件照旧是 UTF-8 带 BOM、CRLF,其余字节不变。三个
.bat和另外两个脚本都不动。批处理改调命令行的 #119 留到 0.39。测过什么
Test-ComponentFiles从脚本里取出来,在严格模式下跑。Windows PowerShell 5.1 和 pwsh 7.6 各一遍:KeyHashes):修好以后返回True;True,哈希不对返回False;False,同时日志里记下了The property 'KeyHashes' cannot be found on this object,说明新加的那行日志有用。tools\modavd.exe和emulator.exe,换上修好的脚本,在新的根目录里跑 新加 fetch 项:新根目录从空补全组件(命令行和补全组件.bat) ModAVDE2E#12 的fetch项:pass:true;批处理那遍走的就是这个脚本,Windows PowerShell 5.1,输入y同意许可协议;pass:false,系统镜像没装上。Refs #118