feat(tui): add create-new-folder option to folder browser

Select-FolderPath gets a [Create new folder] entry. It prompts for a
name, validates it, creates the folder inside the current one and
navigates into it.
This commit is contained in:
2026-11-24 11:40:11 +01:00
parent 37ac448d94
commit 7e1349f1c9
2 changed files with 16 additions and 1 deletions
+6
View File
@@ -1,5 +1,11 @@
# macOS Intune Toolkit Changelog
## 2026-11-24 — v4.4.3 — Create new folder in folder browser
### Added
- **`Scripts/Private/Start-IntuneManagementTui.ps1`**
- `Select-FolderPath` has a new **[Create new folder]** entry. It asks for a name, creates the folder inside the current one and moves into it. Invalid names and creation errors are reported without leaving the browser.
## 2026-11-24 — v4.4.2 — Export built-in Intune roles, fix ASCII header failure
### Fixed
+10 -1
View File
@@ -123,7 +123,7 @@ function Select-FolderPath
while($true)
{
$entries = @("[Use this folder]", "[Type path manually]")
$entries = @("[Use this folder]", "[Create new folder]", "[Type path manually]")
$parent = Split-Path -Path $current -Parent
if($parent) { $entries += ".." }
$subdirs = Get-ChildItem -LiteralPath $current -Directory -ErrorAction SilentlyContinue | Sort-Object Name | ForEach-Object { "$($_.Name)/" }
@@ -135,6 +135,15 @@ function Select-FolderPath
switch ($choice)
{
"[Use this folder]" { return $current }
"[Create new folder]" {
$name = (Read-Host "New folder name (inside $current)").Trim()
if([string]::IsNullOrWhiteSpace($name)) { continue }
if($name.IndexOfAny([IO.Path]::GetInvalidFileNameChars()) -ge 0) { Write-Host "Invalid folder name." -ForegroundColor Yellow; continue }
$newPath = Join-Path $current $name
try { New-Item -ItemType Directory -Path $newPath -Force -ErrorAction Stop | Out-Null; $current = $newPath }
catch { Write-Host "Could not create folder: $($_.Exception.Message)" -ForegroundColor Yellow }
continue
}
"[Type path manually]" { $typed = Read-Host "Enter path"; if(-not [string]::IsNullOrWhiteSpace($typed)) { return $typed }; continue }
".." { $current = $parent; continue }
default { $current = Join-Path $current ($choice.TrimEnd('/')); continue }