优化投影管理文件夹已存在提示 - #6664
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce789a1ad8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| handler.reject(i18n("schematics.create_directory.failed", targetDir)); | ||
| } | ||
| }, "", new RequiredValidator(), new Validator(i18n("schematics.create_directory.failed.invalid_name"), FileUtils::isNameValid)); | ||
| }, "", new RequiredValidator(), new Validator(i18n("schematics.create_directory.failed.invalid_name"), FileUtils::isNameValid), new Validator(i18n("schematics.create_directory.failed.already_exists"), (it) -> !finalExistingFolders.contains(it))); |
There was a problem hiding this comment.
Recheck directory existence when submitting the name
The validator only checks a case-sensitive snapshot captured before the prompt opens. If another process creates the directory while the dialog is open, or on a case-insensitive filesystem the user enters different casing for an existing name, validation succeeds and Files.createDirectories(targetDir) silently accepts the already-existing directory; the dialog then resolves as though a new folder was created. Retain a live Files.exists(targetDir) check in the submission callback in addition to the interactive validator.
Useful? React with 👍 / 👎.
| i18n("schematics.create_directory.prompt"), | ||
| (result, handler) -> { | ||
| Path targetDir = parent.resolve(result); | ||
| if (Files.exists(targetDir)) { |
|
这么干的意义是什么呢( 原来的检查应该能胜任判断是否存在的功能吧? |
No description provided.