fix updateseq not working in non-submodule folder
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -2,18 +2,45 @@
|
|||||||
setlocal EnableExtensions
|
setlocal EnableExtensions
|
||||||
|
|
||||||
set "script_dir=%~dp0"
|
set "script_dir=%~dp0"
|
||||||
|
set "current_dir=%CD%"
|
||||||
|
set "PROJ_ROOT="
|
||||||
|
|
||||||
|
REM First, check project level (one directory up from current) - most common case
|
||||||
|
for %%I in ("%current_dir%..") do set "project_level=%%~fI"
|
||||||
|
set "project_config=%project_level%\.config\config.json"
|
||||||
|
if exist "%project_config%" (
|
||||||
|
set "PROJ_ROOT=%project_level%"
|
||||||
|
)
|
||||||
|
|
||||||
|
REM If not found at project level, search up from current working directory
|
||||||
|
if not defined PROJ_ROOT (
|
||||||
|
for /f "usebackq delims=" %%I in (`powershell -NoProfile -ExecutionPolicy Bypass -Command "Set-StrictMode -Version Latest; $dir = '%current_dir%'; $found = $null; while ($dir -and -not $found) { $configPath = Join-Path $dir '.config\config.json'; if (Test-Path -LiteralPath $configPath) { $found = $dir; break }; $parent = Split-Path -Parent $dir; if ($parent -eq $dir) { break }; $dir = $parent }; if ($found) { Write-Output $found } else { Write-Output '' }"`) do set "PROJ_ROOT=%%I"
|
||||||
|
)
|
||||||
|
|
||||||
|
REM If still not found, try searching from script location
|
||||||
|
if not defined PROJ_ROOT (
|
||||||
|
for /f "usebackq delims=" %%I in (`powershell -NoProfile -ExecutionPolicy Bypass -Command "Set-StrictMode -Version Latest; $dir = '%script_dir%'; $found = $null; while ($dir -and -not $found) { $configPath = Join-Path $dir '.config\config.json'; if (Test-Path -LiteralPath $configPath) { $found = $dir; break }; $parent = Split-Path -Parent $dir; if ($parent -eq $dir) { break }; $dir = $parent }; if ($found) { Write-Output $found } else { Write-Output '' }"`) do set "PROJ_ROOT=%%I"
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Fallback: try original logic (script in 3 ProjectStructure)
|
||||||
|
if not defined PROJ_ROOT (
|
||||||
for %%I in ("%script_dir%..\..") do set "PROJ_ROOT=%%~fI"
|
for %%I in ("%script_dir%..\..") do set "PROJ_ROOT=%%~fI"
|
||||||
|
)
|
||||||
|
|
||||||
set "CONFIG_DIR=%PROJ_ROOT%\.config"
|
set "CONFIG_DIR=%PROJ_ROOT%\.config"
|
||||||
set "CONFIG_PATH=%CONFIG_DIR%\config.json"
|
set "CONFIG_PATH=%CONFIG_DIR%\config.json"
|
||||||
set "GET_STRUCT_DIR=%CONFIG_DIR%\GetStructDir.ps1"
|
|
||||||
|
|
||||||
if not exist "%CONFIG_PATH%" (
|
if not exist "%CONFIG_PATH%" (
|
||||||
echo [ERROR] config.json not found at %CONFIG_PATH%
|
echo [ERROR] config.json not found at %CONFIG_PATH%
|
||||||
|
if defined project_config (
|
||||||
|
echo Also checked: %project_config%
|
||||||
|
)
|
||||||
echo Please run ConfigLoader.ps1 to deploy helper files.
|
echo Please run ConfigLoader.ps1 to deploy helper files.
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set "GET_STRUCT_DIR=%CONFIG_DIR%\GetStructDir.ps1"
|
||||||
|
|
||||||
if not exist "%GET_STRUCT_DIR%" (
|
if not exist "%GET_STRUCT_DIR%" (
|
||||||
echo [ERROR] GetStructDir.ps1 not found at %GET_STRUCT_DIR%
|
echo [ERROR] GetStructDir.ps1 not found at %GET_STRUCT_DIR%
|
||||||
echo Please run ConfigLoader.ps1 to deploy helper files.
|
echo Please run ConfigLoader.ps1 to deploy helper files.
|
||||||
|
|||||||
@@ -186,9 +186,23 @@ function Add-SequenceFolder {
|
|||||||
[Parameter(Mandatory)] [System.IO.DirectoryInfo]$Directory,
|
[Parameter(Mandatory)] [System.IO.DirectoryInfo]$Directory,
|
||||||
[Parameter(Mandatory)] [hashtable]$Map
|
[Parameter(Mandatory)] [hashtable]$Map
|
||||||
)
|
)
|
||||||
if ($Directory.Name -eq '_archive') { return }
|
if ($Directory.Name -like '_*') { return }
|
||||||
$fullPath = $Directory.FullName
|
$fullPath = $Directory.FullName
|
||||||
if ($Map.ContainsKey($fullPath)) { return }
|
if ($Map.ContainsKey($fullPath)) { return }
|
||||||
|
|
||||||
|
# Check if directory contains sequence files directly (not just subdirectories)
|
||||||
|
$extensions = @('.png','.jpg','.jpeg','.exr','.tif','.tiff','.bmp','.tga')
|
||||||
|
$hasSequenceFiles = Get-ChildItem -LiteralPath $fullPath -File -ErrorAction SilentlyContinue |
|
||||||
|
Where-Object { $extensions -contains $_.Extension.ToLower() } |
|
||||||
|
Select-Object -First 1
|
||||||
|
|
||||||
|
# If it only has subdirectories and no sequence files, skip it
|
||||||
|
$hasSubdirs = Get-ChildItem -LiteralPath $fullPath -Directory -ErrorAction SilentlyContinue |
|
||||||
|
Select-Object -First 1
|
||||||
|
if ($null -eq $hasSequenceFiles -and $null -ne $hasSubdirs) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
$Map[$fullPath] = Resolve-SequenceName -Directory $Directory
|
$Map[$fullPath] = Resolve-SequenceName -Directory $Directory
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,9 +221,9 @@ try {
|
|||||||
$secondaryPattern = if ($useIsoDailyFormat) { 'daily_*' } else { '????-??-??' }
|
$secondaryPattern = if ($useIsoDailyFormat) { 'daily_*' } else { '????-??-??' }
|
||||||
|
|
||||||
$primaryDirs = Get-ChildItem -LiteralPath $root -Directory -Filter $primaryPattern -ErrorAction SilentlyContinue |
|
$primaryDirs = Get-ChildItem -LiteralPath $root -Directory -Filter $primaryPattern -ErrorAction SilentlyContinue |
|
||||||
Where-Object { $_.Name -ne '_archive' }
|
Where-Object { $_.Name -notlike '_*' }
|
||||||
foreach ($d in $primaryDirs) {
|
foreach ($d in $primaryDirs) {
|
||||||
$seqDirs = @(Get-ChildItem -LiteralPath $d.FullName -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -ne '_archive' })
|
$seqDirs = @(Get-ChildItem -LiteralPath $d.FullName -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -notlike '_*' })
|
||||||
if ($seqDirs.Count -eq 0) {
|
if ($seqDirs.Count -eq 0) {
|
||||||
Add-SequenceFolder -Directory $d -Map $sequenceMap
|
Add-SequenceFolder -Directory $d -Map $sequenceMap
|
||||||
} else {
|
} else {
|
||||||
@@ -220,9 +234,9 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$secondaryDirs = Get-ChildItem -LiteralPath $root -Directory -Filter $secondaryPattern -ErrorAction SilentlyContinue |
|
$secondaryDirs = Get-ChildItem -LiteralPath $root -Directory -Filter $secondaryPattern -ErrorAction SilentlyContinue |
|
||||||
Where-Object { $_.Name -ne '_archive' }
|
Where-Object { $_.Name -notlike '_*' }
|
||||||
foreach ($d in $secondaryDirs) {
|
foreach ($d in $secondaryDirs) {
|
||||||
$seqDirs = @(Get-ChildItem -LiteralPath $d.FullName -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -ne '_archive' })
|
$seqDirs = @(Get-ChildItem -LiteralPath $d.FullName -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -notlike '_*' })
|
||||||
if ($seqDirs.Count -eq 0) {
|
if ($seqDirs.Count -eq 0) {
|
||||||
Add-SequenceFolder -Directory $d -Map $sequenceMap
|
Add-SequenceFolder -Directory $d -Map $sequenceMap
|
||||||
} else {
|
} else {
|
||||||
@@ -234,7 +248,7 @@ try {
|
|||||||
|
|
||||||
$directSeqs = Get-ChildItem -LiteralPath $root -Directory -ErrorAction SilentlyContinue |
|
$directSeqs = Get-ChildItem -LiteralPath $root -Directory -ErrorAction SilentlyContinue |
|
||||||
Where-Object {
|
Where-Object {
|
||||||
$_.Name -ne '_archive' -and
|
$_.Name -notlike '_*' -and
|
||||||
$_.Name -notlike 'daily_*' -and
|
$_.Name -notlike 'daily_*' -and
|
||||||
$_.Name -notmatch '^\d{4}-\d{2}-\d{2}$'
|
$_.Name -notmatch '^\d{4}-\d{2}-\d{2}$'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user