-
Notifications
You must be signed in to change notification settings - Fork 155
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
case-sensitive file existence check #1984
base: master
Are you sure you want to change the base?
Conversation
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.
A filesystem may be case sensitive. Mostly depends on OS
@jukzi , good call! I adjusted the checks to account for OS |
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.
please do not explicitly check for OS but use any existing function to compare files for equality.
Understood, hopefully this is closer...
|
You should not need to compare Strings yourself. |
I’d expect to see IFile or IPath to be compared which know whether to do case-sensitive comparisons. |
I believe this is closer to what yall are suggesting...
Will externalize the new string if all is good. |
I think you should test it. I think memberPath.equals(newFilePath) will return true for two paths with different cases on a case-insensitive file system. I think you if want to check if two paths have different case, you should compare the strings. So if the paths are equal but the string representation are not equal, then what's specified is different from what's present. And that problem can be the case for the any segment of the path (project/folder), not just the final segment. |
Ive tested this on Windows 11 and Mac 14.4.1 (default HFS+ or APFS in case-insensitive mode). The expected results look good where an error displays saying the file already exists with the same name, different case. Trying Linux now. |
So, I'm not entirely sure how it's feasible to do this without checking for at least if it's Linux. |
If this approach becomes a challenge, a smaller, targeted fix might be to not selectAndReveal the file and open it an editor if what is returned from
mainPage.createNewFile() will trigger the display of the error message dialog showing "A resource exists with a different case", but it will return a non-null File object whose .exists() method would return false, but is not checked before invoking So perhaps just changing |
You are supposed to find an existing method of signature |
Test Results 1 210 files - 605 1 210 suites - 605 1h 4m 3s ⏱️ - 31m 9s Results for commit 805586d. ± Comparison against base commit 954bc58. This pull request skips 3 tests.
|
Check to address - #1866