mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-11 22:13:20 +03:00
refactor(skills): detect_format_version — один вариант на всех потребителей
Семья была разбита на «знает про автономную EPF/ERF» (form-*, mxl-compile, template-add, help-add) и «не знает» (cfe-borrow, interface-edit, meta-compile, role-compile, subsystem-compile, xdto-compile), плюс редакторски разошедшаяся PS1-копия help-add. Расширенный вариант корректен и для конфигурационных навыков: ветка срабатывает только если <каталог>.xml — корень ExternalDataProcessor/ExternalReport, чего в дереве конфигурации не бывает. Переключатель не нужен — раскопирован как есть. Семья в реестре схлопнута до одного варианта: 11 копий, оба порта. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
1586e909a9
commit
d99d63288e
@@ -1,4 +1,4 @@
|
||||
# interface-edit v1.13 — Edit 1C CommandInterface.xml
|
||||
# interface-edit v1.14 — Edit 1C CommandInterface.xml (+detect_format_version: ветка автономной EPF/ERF)
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory)][Alias('Path')][string]$CIPath,
|
||||
@@ -162,6 +162,14 @@ Assert-EditAllowed $CIPath 'editable'
|
||||
function Detect-FormatVersion([string]$dir) {
|
||||
$d = $dir
|
||||
while ($d) {
|
||||
# Автономная внешняя обработка/отчёт: своего Configuration.xml у неё нет, версию несёт
|
||||
# корень самой обработки. Без этого форма и макет внутри обработки 2.21 писались бы 2.17.
|
||||
$extPath = "$d.xml"
|
||||
if (Test-Path $extPath) {
|
||||
$extText = [System.IO.File]::ReadAllText($extPath, [System.Text.Encoding]::UTF8)
|
||||
$extHead = $extText.Substring(0, [Math]::Min(2000, $extText.Length))
|
||||
if ($extHead -match '<(ExternalDataProcessor|ExternalReport)[ >]' -and $extHead -match '<MetaDataObject[^>]+version="(\d+\.\d+)"') { return $Matches[1] }
|
||||
}
|
||||
$cfgPath = Join-Path $d "Configuration.xml"
|
||||
if (Test-Path $cfgPath) {
|
||||
$cfgText = [System.IO.File]::ReadAllText($cfgPath, [System.Text.Encoding]::UTF8)
|
||||
|
||||
Reference in New Issue
Block a user