begin develop configloader
This commit is contained in:
@@ -6,6 +6,18 @@ param(
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
if (-not $PSScriptRoot) {
|
||||
$PSScriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
}
|
||||
|
||||
$configLoader = Join-Path -Path $PSScriptRoot -ChildPath 'ConfigLoader.ps1'
|
||||
if (-not (Test-Path -LiteralPath $configLoader)) {
|
||||
throw "Missing ConfigLoader.ps1 in $PSScriptRoot"
|
||||
}
|
||||
. $configLoader
|
||||
|
||||
$useIsoDailyFormat = Use-IsoDailyFormat
|
||||
|
||||
function Sync-SequenceFilenames {
|
||||
param(
|
||||
[Parameter(Mandatory)] [string]$SequenceFolderPath,
|
||||
@@ -191,9 +203,12 @@ try {
|
||||
|
||||
$sequenceMap = @{}
|
||||
|
||||
$dailyDirs = Get-ChildItem -LiteralPath $root -Directory -Filter 'daily_*' -ErrorAction SilentlyContinue |
|
||||
$primaryPattern = if ($useIsoDailyFormat) { '????-??-??' } else { 'daily_*' }
|
||||
$secondaryPattern = if ($useIsoDailyFormat) { 'daily_*' } else { '????-??-??' }
|
||||
|
||||
$primaryDirs = Get-ChildItem -LiteralPath $root -Directory -Filter $primaryPattern -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.Name -ne '_archive' }
|
||||
foreach ($d in $dailyDirs) {
|
||||
foreach ($d in $primaryDirs) {
|
||||
$seqDirs = @(Get-ChildItem -LiteralPath $d.FullName -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -ne '_archive' })
|
||||
if ($seqDirs.Count -eq 0) {
|
||||
Add-SequenceFolder -Directory $d -Map $sequenceMap
|
||||
@@ -204,10 +219,9 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
# Scan for YYYY-MM-DD format folders (home convention)
|
||||
$dailyDirsHome = Get-ChildItem -LiteralPath $root -Directory -Filter '????-??-??' -ErrorAction SilentlyContinue |
|
||||
$secondaryDirs = Get-ChildItem -LiteralPath $root -Directory -Filter $secondaryPattern -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.Name -ne '_archive' }
|
||||
foreach ($d in $dailyDirsHome) {
|
||||
foreach ($d in $secondaryDirs) {
|
||||
$seqDirs = @(Get-ChildItem -LiteralPath $d.FullName -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -ne '_archive' })
|
||||
if ($seqDirs.Count -eq 0) {
|
||||
Add-SequenceFolder -Directory $d -Map $sequenceMap
|
||||
@@ -218,9 +232,12 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
# Scan for direct sequence folders (not in daily_* or YYYY-MM-DD folders)
|
||||
$directSeqs = Get-ChildItem -LiteralPath $root -Directory -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.Name -ne '_archive' -and $_.Name -notlike 'daily_*' -and $_.Name -notmatch '^\d{4}-\d{2}-\d{2}$' }
|
||||
Where-Object {
|
||||
$_.Name -ne '_archive' -and
|
||||
$_.Name -notlike 'daily_*' -and
|
||||
$_.Name -notmatch '^\d{4}-\d{2}-\d{2}$'
|
||||
}
|
||||
foreach ($seq in $directSeqs) {
|
||||
Add-SequenceFolder -Directory $seq -Map $sequenceMap
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user