-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
[flutter_tools] tool exit from flutter create when provided just a drive letter #106451
Conversation
/// `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]:$'); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
…ust a drive letter (flutter/flutter#106451)
…ust a drive letter (flutter/flutter#106451)
…ust a drive letter (flutter/flutter#106451)
…ust a drive letter (flutter/flutter#106451)
…ust a drive letter (flutter/flutter#106451)
…ust a drive letter (flutter/flutter#106451)
…ust a drive letter (flutter/flutter#106451)
…ust a drive letter (flutter/flutter#106451)
…ust a drive letter (flutter/flutter#106451)
…ust a drive letter (flutter/flutter#106451)
…ust a drive letter (flutter/flutter#106451)
…ust a drive letter (flutter/flutter#106451)
…ust a drive letter (flutter/flutter#106451)
Fixes #104544
As described on the bug, the core problem is that
dart:io
does not considerD:
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.