vfp_symbols.ps1: reconstruire la schimbarea radacinii; default-uri pe fluxul in-tree

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A5okKjUKMM5Xk1egq2w81P
This commit is contained in:
2026-08-03 08:56:00 +03:00
parent 9b6671b0ed
commit 57c4a63d06

View File

@@ -50,7 +50,8 @@ param(
[string]$Where, [string]$Where,
[string]$Find, [string]$Find,
[string]$Class, [string]$Class,
[string]$CacheRoot = 'D:\ROA\_vfp_textcache\roacnpro', # implicit: fluxul in-tree din ROAACNPRO (textul .vc2/.sc2 sta langa binare, nu intr-un cache)
[string]$CacheRoot = 'D:\ROA\ROAACNPRO',
[string]$ProjectRoot = 'D:\ROA\ROAACNPRO', [string]$ProjectRoot = 'D:\ROA\ROAACNPRO',
[string[]]$PrgDirs = @('Programe', 'COMUN\programe'), [string[]]$PrgDirs = @('Programe', 'COMUN\programe'),
[string]$ExcludePrg = '\\programe\\roa\\', [string]$ExcludePrg = '\\programe\\roa\\',
@@ -60,7 +61,11 @@ param(
) )
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
if (-not $IndexFile) { $IndexFile = Join-Path $CacheRoot '_symbols.tsv' } if (-not $IndexFile) {
# la fluxul in-tree indexul nu se scrie in repo, ci in zona de cache comuna
$IndexFile = if ($CacheRoot -like 'D:\ROA\_vfp_textcache\*') { Join-Path $CacheRoot '_symbols.tsv' }
else { Join-Path ('D:\ROA\_vfp_textcache\' + (Split-Path $ProjectRoot -Leaf).ToLower()) '_symbols.tsv' }
}
# Codepage-ul din antetul .vc2 nu e de incredere (vezi CLAUDE.md), dar aici se citesc doar # Codepage-ul din antetul .vc2 nu e de incredere (vezi CLAUDE.md), dar aici se citesc doar
# cuvinte-cheie si identificatori ASCII, iar fisierele nu sunt niciodata rescrise. # cuvinte-cheie si identificatori ASCII, iar fisierele nu sunt niciodata rescrise.
@@ -184,6 +189,16 @@ function Build-Index {
function Test-IndexStale { function Test-IndexStale {
if (-not (Test-Path $IndexFile)) { return $true } if (-not (Test-Path $IndexFile)) { return $true }
# acelasi -IndexFile poate veni dintr-o alta radacina (alt -CacheRoot): datele vechi nu par invechite
$head = Get-Content -LiteralPath $IndexFile -TotalCount 2
if ($head.Count -ge 2) {
$cols = $head[1].Split("`t")
if ($cols.Count -gt 4) {
$src = $cols[4].Trim('"')
if (-not ($src.StartsWith($CacheRoot, 'OrdinalIgnoreCase') -or
$src.StartsWith($ProjectRoot, 'OrdinalIgnoreCase'))) { return $true }
}
}
$idx = (Get-Item $IndexFile).LastWriteTime $idx = (Get-Item $IndexFile).LastWriteTime
foreach ($f in (Get-SourceFiles)) { if ($f.LastWriteTime -gt $idx) { return $true } } foreach ($f in (Get-SourceFiles)) { if ($f.LastWriteTime -gt $idx) { return $true } }
$false $false