Repository navigation
Description
Install-NerdFont currently creates its temporary download directory under $HOME (i.e. $Env:USERPROFILE on Windows):
NerdFonts/src/functions/public/Install-NerdFont.ps1
Lines 82 to 83 in ef4331d
| $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
cleanblock continues to work - No change in behavior when the command completes successfully
Related
- Handle dependencies better and refactor for reproducibility #57 — Closed PR that included this change among others
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
- Change the temp directory base path from
$HOMEto[System.IO.Path]::GetTempPath()insrc/functions/public/Install-NerdFont.ps1 - Verify cleanup in the
cleanblock still removes the directory correctly - Test on Windows and (if CI supports it) Linux/macOS
Activity
MariusStorhaug commentedon Aug 8, 2026
Closing as completed: Install-NerdFont now uses [System.IO.Path]::GetTempPath() for its temporary workspace, and the clean block removes that directory. Direct execution of the current source confirmed both the system-temp location and cleanup.