[Request for Comments] File extension redux

Roger Riggs roger.riggs at oracle.com
Wed Oct 11 18:33:33 UTC 2023


Hi,

Typically a leading "." (for the directories "." and "..") would not be 
considered the start of an extension.  (As was spec'd earlier). Both 
"/." and "/.." have an empty extension.

I would suggest that `removeExtension()` would be more useful if it 
removed the final ".", if any.
`addExtension("txt")` would be smart enough to handle both "abc." and 
"abc" resulting in "abc.txt".

$.02, Roger

On 10/11/23 12:55 PM, Brian Burkhalter wrote:
> I’ve not gone through 100% of the edge cases, but for this one I would 
> think both add and remove would not affect “.” or “foo.”.
>
> Brian
>
>> On Oct 11, 2023, at 9:50 AM, David Lloyd <david.lloyd at redhat.com> wrote:
>>
>> For the edge case where the file ends in, /or/ comprises, a solitary 
>> `.`, would `removeExtension()` remove the `.` and `addExtension("")` 
>> add it back, or would both methods leave the path unaffected (either 
>> one would satisfy the invariant)? Or some other behavior?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/nio-dev/attachments/20231011/d72a367a/attachment-0001.htm>


More information about the nio-dev mailing list