Skip to content

feat(powershell): open projects folder on a Dev Drive when present - #718

Merged
DevSecNinja merged 1 commit into
mainfrom
devsecninja-fictional-fiesta
Aug 14, 2026
Merged

feat(powershell): open projects folder on a Dev Drive when present#718
DevSecNinja merged 1 commit into
mainfrom
devsecninja-fictional-fiesta

Conversation

@DevSecNinja

Copy link
Copy Markdown
Owner

Source code on the NTFS system drive is subject to real-time antivirus scanning and generally slower IO than a Dev Drive, the ReFS volume Windows 11 provides specifically for developer workloads. Until now the PowerShell profile always dropped you in %USERPROFILE%\projects, so having a Dev Drive did nothing for the shell.

Approach

A new DevDrive.ps1 in the DotfilesHelpers module resolves the projects folder in this order:

  1. $env:PROJECTS_PATH, when set
  2. <Dev Drive>\projects, when a Dev Drive has one
  3. %USERPROFILE%\projects

profile.ps1 now calls Get-ProjectsPath for the startup cd (the Import-Module was moved above that block so the function is available), and the Windows run_once_before_00-setup.ps1 creates the projects folder on the Dev Drive when one is present. Unix shell configs are untouched, since Dev Drive is Windows-only.

Non-obvious bits worth reviewing

  • Detection is a heuristic. fsutil devdrv query is the authoritative check but requires an elevated shell, which a profile never has (verified: it returns "Access is denied" unelevated). Fixed, ready ReFS volumes are used instead, which is correct on a normal workstation but would false-positive on a plain ReFS data volume. $env:DEV_DRIVE pins a specific volume and $env:PROJECTS_PATH skips detection entirely.
  • The profile path never touches disk. Get-ProjectsPath only creates directories under the opt-in -CreateIfMissing switch, so startup cost stays at an in-memory DriveInfo enumeration with no CIM call.
  • Graceful degradation. If DotfilesHelpers fails to import, the profile falls back to the old %USERPROFILE%\projects behavior rather than erroring.
  • DevDrive.ps1 is intentionally unsigned; the sign-powershell.yml workflow signs it after merge.

Testing

New tests/powershell/DevDrive.Tests.ps1 covers both env var overrides, the Dev Drive hit, the user-profile fallback, and that nothing is created without -CreateIfMissing. Profile.Tests.ps1 gained an ordering assertion so the module import can't drift back below the cd block. 188 tests pass across the affected files; PSScriptAnalyzer reports no new warnings.

Docs: new "Projects folder and Dev Drive" section in customization.md, plus a pointer from the Windows install steps.

Add Get-DevDrivePath/Get-ProjectsPath to DotfilesHelpers so the PowerShell profile cds into the Dev Drive projects folder instead of %USERPROFILE%\projects when a Dev Drive (fixed ReFS volume) exists. DEV_DRIVE pins a volume, PROJECTS_PATH overrides the folder outright. The Windows run_once setup script now creates the projects folder on the Dev Drive.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: af6ad983-307e-490a-adc1-d9e30131dadd
@DevSecNinja
DevSecNinja merged commit 29fdeb2 into main Aug 14, 2026
19 checks passed
@DevSecNinja
DevSecNinja deleted the devsecninja-fictional-fiesta branch August 14, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant