RFR: 8057113: (fs) Path should have a method to obtain the filename extension [v18]

Brian Burkhalter bpb at openjdk.org
Thu Oct 6 20:05:24 UTC 2022


On Mon, 3 Oct 2022 20:05:13 GMT, Mark Reinhold <mr at openjdk.org> wrote:

> Is that because those systems are interpreting the `txt` suffix, or is it because they always open files of unknown type with the platform’s default text editor?

Looks like a bit of each. Files named `.xy74j0` and `...xy74j0` with identical text content are opened by the default text editor on Linux. On macOS, `.xy74j0` is also opened by the default text editor but clicking on `...xy74j0` results in a popup which states

`There is no application set to open the document “...xy74j0”.`

On Windows, a popup appears in both cases asking that an appropriate app be selected to open the file.

So it looks like on Linux a file of unknown type might always be opened by the default text editor, but based on this example and the previous `...txt` example, on macOS and Windows there is some inference of the file type from the file name or extension, however the latter is defined.

-------------

PR: https://git.openjdk.org/jdk/pull/8066


More information about the nio-dev mailing list