Skip to content

Hide create_directory function overload with ec#198

Merged
bugdea1er merged 4 commits into
mainfrom
hide-private-functions
Apr 19, 2025
Merged

Hide create_directory function overload with ec#198
bugdea1er merged 4 commits into
mainfrom
hide-private-functions

Conversation

@bugdea1er
Copy link
Copy Markdown
Owner

@bugdea1er bugdea1er commented Apr 19, 2025

Removed the "public" declaration of the create_file and create_directory overloads with std::error_code

@bugdea1er bugdea1er requested a review from Copilot April 19, 2025 12:16
Copy link
Copy Markdown

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

This PR hides the create_directory overload that accepts an std::error_code parameter from the public API while ensuring the throwing overload remains accessible.

  • Removed the overload declaration with std::error_code from src/create.hpp.
  • Moved the implementation of the error-code overload into an unnamed namespace in src/create.cpp and reintroduced the public throwing overload.

Reviewed Changes

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

File Description
src/create.hpp Removed declaration of the create_directory overload that takes ec.
src/create.cpp Internalized the error-reporting overload in an unnamed namespace and reordered function definitions.
Comments suppressed due to low confidence (1)

src/create.cpp:106

  • [nitpick] Consider annotating or renaming this internal overload to clearly indicate it is for internal error reporting, which can help prevent accidental misuse and improve code maintainability.
fs::path create_directory(std::string_view prefix, std::error_code& ec) {

@bugdea1er bugdea1er requested a review from Copilot April 19, 2025 12:21
Copy link
Copy Markdown

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

This PR hides the error_code overload of the create_directory function and refactors the file API to use a single public interface.

  • Removed the public declaration of the create_directory overload with std::error_code in the header.
  • Moved and restructured internal error_code–based implementations in the source file.
  • Consolidated similar error handling patterns for temporary file creation across platforms.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/create.hpp Removed the error_code overload declarations from the public API.
src/create.cpp Reorganized the internal implementations and moved the public overloads to invoke the hidden error_code versions.
Comments suppressed due to low confidence (1)

src/create.cpp:190

  • [nitpick] Consider placing the internal create_directory overload (using std::error_code) into an anonymous namespace or marking it static so that its separation from the public API is clearer.
fs::path create_directory(std::string_view prefix) {

Repository owner deleted a comment from Copilot AI Apr 19, 2025
@bugdea1er bugdea1er marked this pull request as ready for review April 19, 2025 12:29
@bugdea1er bugdea1er merged commit 24707c7 into main Apr 19, 2025
16 checks passed
@bugdea1er bugdea1er deleted the hide-private-functions branch April 19, 2025 12:29
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.

2 participants