Install-NerdFont currently creates its temporary download directory under $HOME (i.e. $Env:USERPROFILE on Windows):
|
$tempPath = Join-Path -Path $HOME -ChildPath "NerdFonts-$guid" |
|
if (-not (Test-Path -Path $tempPath -PathType Container)) { |
$guid = (New-Guid).Guid
$tempPath = Join-Path -Path $HOME -ChildPath "NerdFonts-$guid"
If the command fails or is interrupted before the clean block runs, the temporary directory with downloaded archives persists in the user's home folder. This location is not subject to automatic cleanup by the OS (Disk Cleanup on Windows, tmpwatch/systemd-tmpfiles on Linux), so the leftover directories accumulate silently.
Request
Current experience
Temporary download artifacts are left in the user's home directory on failure. The user must manually discover and delete NerdFonts-<guid> folders.
Desired experience
Temporary files should reside under the system-designated temp directory ($Env:TEMP on Windows, /tmp on Linux/macOS). If the command fails, the OS or its cleanup utilities can reclaim the space automatically. The home directory remains clean.
Acceptance criteria
- The temporary download directory is created under the appropriate system temp path, not
$HOME
- The GUID-based naming scheme can be retained or simplified, as long as collisions remain improbable
- Existing cleanup logic in the
clean block continues to work
- No change in behavior when the command completes successfully
Related
Technical decisions
Temp path source: Use [System.IO.Path]::GetTempPath() or $Env:TEMP (Windows) / the equivalent on other platforms. Both are idiomatic. [System.IO.Path]::GetTempPath() is cross-platform by default.
Directory naming: Keep using New-Guid for uniqueness — it is fast, trivially unique, and already in use. No reason to change the naming scheme.
Implementation plan
Install-NerdFontcurrently creates its temporary download directory under$HOME(i.e.$Env:USERPROFILEon Windows):NerdFonts/src/functions/public/Install-NerdFont.ps1
Lines 82 to 83 in ef4331d
If the command fails or is interrupted before the
cleanblock runs, the temporary directory with downloaded archives persists in the user's home folder. This location is not subject to automatic cleanup by the OS (Disk Cleanup on Windows, tmpwatch/systemd-tmpfiles on Linux), so the leftover directories accumulate silently.Request
Current experience
Temporary download artifacts are left in the user's home directory on failure. The user must manually discover and delete
NerdFonts-<guid>folders.Desired experience
Temporary files should reside under the system-designated temp directory (
$Env:TEMPon Windows,/tmpon Linux/macOS). If the command fails, the OS or its cleanup utilities can reclaim the space automatically. The home directory remains clean.Acceptance criteria
$HOMEcleanblock continues to workRelated
Technical decisions
Temp path source: Use
[System.IO.Path]::GetTempPath()or$Env:TEMP(Windows) / the equivalent on other platforms. Both are idiomatic.[System.IO.Path]::GetTempPath()is cross-platform by default.Directory naming: Keep using
New-Guidfor uniqueness — it is fast, trivially unique, and already in use. No reason to change the naming scheme.Implementation plan
$HOMEto[System.IO.Path]::GetTempPath()insrc/functions/public/Install-NerdFont.ps1cleanblock still removes the directory correctly