-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
[gen_l10n] Throw error when arb file does not exist #107583
Conversation
final String templateArbFileStatModeString = templateArbFileStat.modeString(); | ||
final FileSystemEntityType templateArbFileStatType = templateArbFileStat.type; | ||
if (templateArbFileStatType == FileSystemEntityType.notFound) { | ||
final String templateArbFileStatModeString = templateArbFile.statSync().modeString(); |
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.
This variable isn't used
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.
It's used in line 952 to check the permissions of the file, I think. I can put it right before that if-block if it makes it clearer.
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.
It's all good, my mistake. See below.
if (templateArbFileStatType == FileSystemEntityType.notFound) { | ||
final String templateArbFileStatModeString = templateArbFile.statSync().modeString(); | ||
final bool templateArbFileExists = templateArbFile.existsSync(); | ||
if (!templateArbFileExists) { |
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.
Could just be if (!templateArbFile.existsSync())
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.
Sorry, I was looking at the diffs not at the overall context. The version of the code you had originally, that just relied on one stat call made sense as it was. Sorry about the (my) confusion.
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.
LGTM
Currently, attempting to generate localization files checks for permissions on the template arb file but does not check whether the file exists or not. This PR changes this so that a more helpful error is thrown.
#106139
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.