Replace manual temp directory creation with New-TempFolder helper#26443
Replace manual temp directory creation with New-TempFolder helper#26443
Conversation
…ction Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR eliminates code duplication by replacing manual temporary directory creation with the existing New-TempFolder helper function in the New-MacOsDistributionPackage function.
- Replaces two lines of manual temp directory creation with a single call to
New-TempFolder - Makes the code more consistent with other functions in the same module (e.g.,
New-MacOSPackage) - Improves safety by using the helper's
Test-Pathcheck instead of-Force
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@TravisEz13 this pr isn't the right way for this direction of travel overall & I'm not quite happy with copliot having used cpu time on this for such little a gain in the grand scheme of things & as such I'd like it if we closed this. Instead we should have a new cmdlet Hope that makes sense |
|
Copilot is stupid. |
PR Summary
Eliminates code duplication in
New-MacOsDistributionPackageby replacing manual temp directory creation with the existingNew-TempFolderhelper function.PR Context
The
New-MacOsDistributionPackagefunction manually created temp directories instead of usingNew-TempFolder, which is used throughout the rest of the codebase (e.g., inNew-MacOSPackage).Before:
After:
Net: -1 line. The
New-TempFolderhelper includes aTest-Pathcheck before creation, making it marginally safer than the original-Forceapproach.Addresses #26441 (comment)
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/PowerShell/PowerShell/pulls/26441/commentscurl -s REDACTED(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.