Skip to content

Add TempFile.GeneratePath and TempDirectory.GeneratePath#37

Merged
Tyrrrz merged 6 commits intoprimefrom
copilot/add-static-tempfile-and-tempdirectory-generatepath
Apr 16, 2026
Merged

Add TempFile.GeneratePath and TempDirectory.GeneratePath#37
Tyrrrz merged 6 commits intoprimefrom
copilot/add-static-tempfile-and-tempdirectory-generatepath

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 16, 2026

Adds static GeneratePath() methods to TempFile and TempDirectory that return a unique temp path string without touching the filesystem. Refactors Create() to delegate path generation to GeneratePath(), eliminating duplicated logic.

Changes

  • TempFile.GeneratePath() — returns a GUID-based .tmp path under the system temp directory
  • TempDirectory.GeneratePath() — returns a GUID-based directory path under the system temp directory
  • TempFile.Create / TempDirectory.Create — now call GeneratePath() internally instead of inlining equivalent logic

Usage

// Get a unique path without creating anything on disk
string path = TempFile.GeneratePath();
string dirPath = TempDirectory.GeneratePath();

// Create still works as before, now backed by GeneratePath
using var tempFile = TempFile.Create();
using var tempDir = TempDirectory.Create();

@Tyrrrz Tyrrrz added the enhancement New feature or request label Apr 16, 2026
@Tyrrrz Tyrrrz marked this pull request as ready for review April 16, 2026 11:02
Copilot AI review requested due to automatic review settings April 16, 2026 11:02
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 81.81818% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.18%. Comparing base (d97cf77) to head (b0005fa).
⚠️ Report is 1 commits behind head on prime.

Files with missing lines Patch % Lines
PowerKit/TempDirectory.cs 71.42% 1 Missing and 1 partial ⚠️
PowerKit/TempFile.cs 71.42% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            prime      #37      +/-   ##
==========================================
+ Coverage   94.08%   94.18%   +0.09%     
==========================================
  Files          76       76              
  Lines        1489     1497       +8     
  Branches      124      125       +1     
==========================================
+ Hits         1401     1410       +9     
+ Misses         67       65       -2     
- Partials       21       22       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread PowerKit/TempDirectory.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds new GeneratePath() helpers to produce unique temp file/directory paths (without creating anything), and refactors Create() to reuse that shared path-generation logic.

Changes:

  • Added TempFile.GeneratePath() returning a GUID-based *.tmp path under the system temp directory.
  • Added TempDirectory.GeneratePath() returning a GUID-based directory path under the system temp directory.
  • Updated TempFile.Create() / TempDirectory.Create() to call GeneratePath() and added basic tests for the new APIs.

Reviewed changes

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

File Description
PowerKit/TempFile.cs Adds GeneratePath() and refactors Create() to delegate temp path generation.
PowerKit/TempDirectory.cs Adds GeneratePath() and refactors Create() to delegate temp path generation.
PowerKit.Tests/TempFileTests.cs Adds a unit test validating GeneratePath() returns a non-empty path and doesn’t create a file.
PowerKit.Tests/TempDirectoryTests.cs Adds a unit test validating GeneratePath() returns a non-empty path and doesn’t create a directory.

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

Copilot AI requested a review from Tyrrrz April 16, 2026 11:06
@Tyrrrz Tyrrrz changed the title Add TempFile.GeneratePath and TempDirectory.GeneratePath; use them in Create Add TempFile.GeneratePath and TempDirectory.GeneratePath Apr 16, 2026
@Tyrrrz Tyrrrz merged commit 0637e52 into prime Apr 16, 2026
7 checks passed
@Tyrrrz Tyrrrz deleted the copilot/add-static-tempfile-and-tempdirectory-generatepath branch April 16, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants