Skip to content

fix: replace $windir with $env:SystemRoot in Themes module#1667

Merged
RadNotRed merged 2 commits into
Atlas-OS:new-updatefrom
Stensel8:new-update
May 21, 2026
Merged

fix: replace $windir with $env:SystemRoot in Themes module#1667
RadNotRed merged 2 commits into
Atlas-OS:new-updatefrom
Stensel8:new-update

Conversation

@Stensel8

@Stensel8 Stensel8 commented May 20, 2026

Copy link
Copy Markdown
Contributor

Fixes PSScriptAnalyzer warning PSUseDeclaredVarsMoreThanAssignments in Themes.psm1. https://github.com/Atlas-OS/Atlas/actions/runs/26191839863/job/77061913812

$windirwas assigned inThemes.psm1but only used via outer-scope inDomain/ThemeRegistry.ps1`.

PSScriptAnalyzer flags it as unused since it has no direct usage in the file.

  • Replace $windir in ThemeRegistry.ps1 with $env:SystemRoot (built-in env var)

This resolves the linter error without breaking functionality. See: https://github.com/Stensel8/Atlas-patches/actions/runs/26193046913/job/77065954691

The results/outputs will be the same, but this is a more modern approach to handle this env var. Using $windir was a thing of the CMD/BAT conventions. The more modern approach is to use $env:

Questions

Remove unused variable '$windir' from Themes.psm1
@Stensel8 Stensel8 requested a review from Xyueta as a code owner May 20, 2026 22:07
Copilot AI review requested due to automatic review settings May 20, 2026 22:07
@Stensel8 Stensel8 requested a review from RadNotRed as a code owner May 20, 2026 22:07
@github-actions github-actions Bot added the playbook Playbook related issues/PRs label May 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR intends to remove an allegedly unused $windir variable from the Themes PowerShell module.

Changes:

  • Removed the $windir = [Environment]::GetFolderPath('Windows') assignment from Themes.psm1.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Stensel8 Stensel8 marked this pull request as draft May 20, 2026 22:09
@Stensel8 Stensel8 changed the title chore: Cleanup unused variable '$windir' fix: replace outer-scope $windir with $env:SystemRoot in Themes module May 20, 2026
@Stensel8 Stensel8 requested a review from Copilot May 20, 2026 22:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@Stensel8 Stensel8 marked this pull request as ready for review May 20, 2026 22:17
@Stensel8 Stensel8 changed the title fix: replace outer-scope $windir with $env:SystemRoot in Themes module chore: replace outer-scope $windir with $env:SystemRoot in Themes module May 20, 2026
@Stensel8 Stensel8 changed the title chore: replace outer-scope $windir with $env:SystemRoot in Themes module chore: replace $windir with $env:SystemRoot in Themes module May 20, 2026
@Stensel8 Stensel8 changed the title chore: replace $windir with $env:SystemRoot in Themes module fix: replace $windir with $env:SystemRoot in Themes module May 20, 2026
@RadNotRed

Copy link
Copy Markdown
Member

@ me when this is complete please

@Stensel8

Stensel8 commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

@ me when this is complete please

@RadNotRed Technically it is complete now. The variable is now implemented correctly.

I saw I introduced a small bug in my previous commit. That is why it was on draft in the beginning😄

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@RadNotRed RadNotRed merged commit 4d89810 into Atlas-OS:new-update May 21, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

playbook Playbook related issues/PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants