Skip to content

Add the ability to create directories #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 22, 2025

Conversation

brianquinlan
Copy link
Contributor

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

@brianquinlan brianquinlan requested a review from devoncarew April 22, 2025 17:10
Copy link
Member

@devoncarew devoncarew left a comment

Choose a reason for hiding this comment

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

Two comments, either is blocking.

///
/// If the parent path does not exist, then `PathNotFoundException` is thrown.
void createDirectory(String path) {
throw UnsupportedError('createDirectory');
Copy link
Member

Choose a reason for hiding this comment

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

Not necessarily for this PR, but if you create a utility method unsupportedError(String), then this impl. could be:

void createDirectory(String path) => unsupportedError('createDirectory');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm talking with @lrhn now about whether this class should just be abstract/interface. If it lands that way, then all of these will disappear.

// Calling `GetLastError` for the first time causes the `GetLastError`
// symbol to be loaded, which resets `GetLastError`. So make a harmless
// call before the value is needed.
win32.GetLastError();
Copy link
Member

Choose a reason for hiding this comment

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

We may want to either:

  • create a small 'primeLastError()' method in this library which does the same thing; this would let us avoid copying the 'why are we doing this' comment many times, or
  • have a lastError() wrapper which accepts a closure; the wrapper can handle last error stuff, and the closure can do the actual work. this pattern may be less clear though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great idea! I'll go with the first idea, which will make it easy to remove when I fix this in the SDK.

@brianquinlan brianquinlan merged commit 262c824 into dart-lang:main Apr 22, 2025
17 checks passed
@brianquinlan brianquinlan deleted the create_directory_posix branch April 24, 2025 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants