Fixes working directory handling

Ensures build and cleanup processes run from the expected project location.

Prevents temporary state files from being created or removed in the wrong folder, which avoids stale markers and cleanup failures when launched from the UI or another directory.
This commit is contained in:
rbalsleyMSFT
2026-03-10 17:01:40 -07:00
parent e7589f6ceb
commit 9bacac8f3d
2 changed files with 12 additions and 8 deletions
+4 -2
View File
@@ -5692,7 +5692,8 @@ If (Test-Path -Path "$FFUDevelopmentPath\dirty.txt") {
Get-FFUEnvironment Get-FFUEnvironment
} }
WriteLog 'Creating dirty.txt file' WriteLog 'Creating dirty.txt file'
New-Item -Path .\ -Name "dirty.txt" -ItemType "file" | Out-Null $dirtyFilePath = Join-Path -Path $FFUDevelopmentPath -ChildPath 'dirty.txt'
New-Item -Path $dirtyFilePath -ItemType "file" | Out-Null
# Early CLI prompt for additional FFUs (only if enabled and not provided) # Early CLI prompt for additional FFUs (only if enabled and not provided)
if ($BuildUSBDrive -and $CopyAdditionalFFUFiles -and ((-not $AdditionalFFUFiles) -or ($AdditionalFFUFiles.Count -eq 0))) { if ($BuildUSBDrive -and $CopyAdditionalFFUFiles -and ((-not $AdditionalFFUFiles) -or ($AdditionalFFUFiles.Count -eq 0))) {
@@ -7615,7 +7616,8 @@ else {
} }
#Clean up dirty.txt file #Clean up dirty.txt file
Remove-Item -Path .\dirty.txt -Force | out-null $dirtyFilePath = Join-Path -Path $FFUDevelopmentPath -ChildPath 'dirty.txt'
Remove-Item -Path $dirtyFilePath -Force | out-null
# Remove per-run session folder if present # Remove per-run session folder if present
$sessionDir = Join-Path $FFUDevelopmentPath '.session' $sessionDir = Join-Path $FFUDevelopmentPath '.session'
if (Test-Path -Path $sessionDir) { if (Test-Path -Path $sessionDir) {
+2
View File
@@ -295,6 +295,7 @@ $script:uiState.Controls.btnRun.Add_Click({
$startCleanupParams = @{ $startCleanupParams = @{
FilePath = $pwshPath FilePath = $pwshPath
ArgumentList = $cleanupArgs ArgumentList = $cleanupArgs
WorkingDirectory = $ffuDevPath
PassThru = $true PassThru = $true
} }
if ($Host.Name -eq 'ConsoleHost') { if ($Host.Name -eq 'ConsoleHost') {
@@ -457,6 +458,7 @@ $script:uiState.Controls.btnRun.Add_Click({
$startBuildParams = @{ $startBuildParams = @{
FilePath = $pwshPath FilePath = $pwshPath
ArgumentList = $pwshArgs ArgumentList = $pwshArgs
WorkingDirectory = $config.FFUDevelopmentPath
PassThru = $true PassThru = $true
} }
if ($Host.Name -eq 'ConsoleHost') { if ($Host.Name -eq 'ConsoleHost') {