Repository navigation
fix(#257, #263): Windows install を mise の stderr と改名 pointer に耐えるようにする #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,15 @@ function Move-LegacyHoxayStateDir { | |
| if (Test-Path $current) { return } | ||
| if (-not (Test-Path $legacy)) { return } | ||
| Move-Item -LiteralPath $legacy -Destination $current | ||
| # `current_app` holds an absolute path into the moved directory — | ||
| # rewrite it, or the pointer keeps addressing the old location. | ||
| $appFile = Join-Path $current "current_app" | ||
| if (Test-Path $appFile) { | ||
| $app = (Get-Content $appFile -Raw).Trim() | ||
| if ($app -and $app.StartsWith($legacy, [System.StringComparison]::OrdinalIgnoreCase)) { | ||
| Set-Content -Path $appFile -Value ("$current" + $app.Substring($legacy.Length)) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 末尾の区切り文字を考慮してパスを結合してください。
旧ディレクトリの表現を正規化し、残りの相対パスを
|
||
| } | ||
| } | ||
| Write-Host "[hoxay] state dir renamed: $legacy -> $current" | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,6 +63,16 @@ migrate_legacy_state_dir() { | |
| return 0 | ||
| fi | ||
| mv "$legacy" "$current" || die "cannot move legacy state dir $legacy -> $current" | ||
| # `current_app` holds an absolute path into the moved directory — rewrite | ||
| # it, or the pointer keeps addressing the old location. | ||
| local app_file="$current/current_app" | ||
| if [[ -f "$app_file" ]]; then | ||
| local app | ||
| app="$(cat "$app_file")" | ||
| if [[ "$app" == "$legacy"* ]]; then | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ディレクトリ境界を含めて一致を判定してください。
通常の起動は fallback で元のアプリを再発見できますが、保存値は不正になります。旧ディレクトリを正規化し、
|
||
| printf '%s\n' "$current${app#"$legacy"}" > "$app_file" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 旧パスの末尾
旧パスの末尾区切りを正規化し、新パスと相対部分の間に
|
||
| fi | ||
| fi | ||
| log "state dir renamed: $legacy -> $current" | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,12 +83,18 @@ $env:MISE_IGNORED_CONFIG_PATHS = $ignored | |
|
|
||
| Push-Location $target | ||
| try { | ||
| mise install --locked | Out-Null | ||
| # Windows PowerShell 5.1 turns a native command's stderr into a | ||
| # terminating error while $ErrorActionPreference is Stop, and mise | ||
| # writes its banner to stderr (rebuildup/pc-setup#257). Run the native | ||
| # build steps with the preference relaxed and with stderr folded into | ||
| # stdout, and judge them by their exit code. | ||
| $ErrorActionPreference = "Continue" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ビルド終了時に この代入は後続の選択処理にも残ります。 例えば、既存の 変更前の設定値を保存し、既存の
|
||
| mise install --locked 2>&1 | Out-Null | ||
| if ($LASTEXITCODE -ne 0) { Die "mise install failed" } | ||
| bun install --frozen-lockfile | Out-Null | ||
| bun install --frozen-lockfile 2>&1 | Out-Null | ||
| if ($LASTEXITCODE -ne 0) { Die "bun install failed" } | ||
| $env:CSC_IDENTITY_AUTO_DISCOVERY = "false" | ||
| bun run desktop:pack | Out-Null | ||
| bun run desktop:pack 2>&1 | Out-Null | ||
| if ($LASTEXITCODE -ne 0) { Die "electron-builder failed" } | ||
| } finally { | ||
| Pop-Location | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
移動済みのディレクトリでも
current_appを修復してください。#263で報告された端末は、既に旧ディレクトリを移動済みです。この状態では Line 30 で戻るため、今回追加した修復を実行しません。起動は fallback で継続できますが、報告された無効なポインタは残ります。(github.com)移動処理と修復処理を分離してください。旧ディレクトリが既にない場合も、新ディレクトリ内のポインタを冪等に修復してください。
common.shの同じ早期 return も対象です。