Skip to content
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

[flutter_tools] tool exit from flutter create when provided just a drive letter #106451

Conversation

christopherfujino
Copy link
Member

Fixes #104544

As described on the bug, the core problem is that dart:io does not consider D: an absolute path and thus treats it like a relative path and prepends it with the current working directory: https://github.com/dart-lang/sdk/blob/main/sdk/lib/io/file_system_entity.dart#L571.

Creating an app at the root of a drive is probably a user error anyway (they probably want it contained in a folder), so we tool exit with instructions on how to create it in a folder at the top level of the drive, or alternatively to specify D:\ if they really want it at the root of the drive.

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jun 23, 2022
/// `dart:io` does not recognize strings matching this pattern as absolute
/// paths, as they have no top level back-slash; however, users often specify
/// this
static final RegExp _kWindowsDrivePattern = RegExp(r'^[A-Z]:$');
Copy link
Member

Choose a reason for hiding this comment

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

Is there anything helpful in package:path instead of potentially duplicating this logic?

Copy link
Member Author

Choose a reason for hiding this comment

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

I see rootPattern, but that is a superset of what we want here, including a trailing slash (this is the same pattern that dart:io uses).

However, from looking at that, I can see that this regex should include lower-case letters.

Copy link
Member Author

Choose a reason for hiding this comment

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

oh wait, never mind, this helper looks like it does the trick: https://github.com/dart-lang/path/blob/master/lib/src/utils.dart#L18

Copy link
Member

Choose a reason for hiding this comment

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

I saw that, but couldn't tell if it was public.

Copy link
Member Author

Choose a reason for hiding this comment

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

Shucks, it isn't exported

@fluttergithubbot fluttergithubbot merged commit 67dd01e into flutter:master Jun 24, 2022
@christopherfujino christopherfujino deleted the tool-exit-on-flutter-create-with-drive-letter branch June 24, 2022 21:26
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 28, 2022
camsim99 pushed a commit to camsim99/flutter that referenced this pull request Aug 10, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 30, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[flutter_tools] FileSystemException Exists failed, path = 'D:\D:\android\app'
4 participants