Skip to content

Add Directory.Reset extension#24

Merged
Tyrrrz merged 4 commits intoprimefrom
copilot/add-directory-reset-extension
Apr 14, 2026
Merged

Add Directory.Reset extension#24
Tyrrrz merged 4 commits intoprimefrom
copilot/add-directory-reset-extension

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 14, 2026

Adds a Directory.Reset extension method on Directory that deletes the directory recursively and recreates it as an empty directory.

Directory.Reset("/some/path"); // deletes all contents, then recreates as empty dir
  • DirectoryExtensions.cs: Implements Directory.Reset(string path) — no-ops gracefully if the directory doesn't exist (just creates it)
  • DirectoryExtensionsTests.cs: Tests for existing directory with contents and non-existent path

Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/14aee23b-4686-454b-aaea-0eeb629efc3e

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Comment thread PowerKit/Extensions/DirectoryExtensions.cs Outdated
Copilot AI requested a review from Tyrrrz April 14, 2026 16:26
@Tyrrrz
Copy link
Copy Markdown
Owner

Tyrrrz commented Apr 14, 2026

@copilot resolve the merge conflicts in this pull request

…y-reset-extension

# Conflicts:
#	PowerKit.Tests/DirectoryExtensionsTests.cs
#	PowerKit/Extensions/DirectoryExtensions.cs

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 14, 2026

@copilot resolve the merge conflicts in this pull request

Done in 66a47a5. Merged origin/prime and kept both Directory.Reset (from this PR) and Directory.TryDelete (from prime) in the resolved files. All 114 tests pass.

@Tyrrrz Tyrrrz marked this pull request as ready for review April 14, 2026 16:39
Copilot AI review requested due to automatic review settings April 14, 2026 16:39
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 a new Directory.Reset(string path) extension to PowerKit’s DirectoryExtensions, providing a simple way to delete a directory (recursively) and recreate it as an empty directory—while gracefully handling the “directory doesn’t exist” case.

Changes:

  • Implemented Directory.Reset(string path) in PowerKit.Extensions.
  • Added tests covering reset of an existing directory with contents and a non-existent directory path.

Reviewed changes

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

File Description
PowerKit/Extensions/DirectoryExtensions.cs Adds Directory.Reset(...) which deletes recursively (ignoring DirectoryNotFoundException) and recreates the directory.
PowerKit.Tests/DirectoryExtensionsTests.cs Adds coverage for Reset behavior on existing and non-existent directories.

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

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