Tcl Source Code

View Ticket
Login
Ticket UUID: fd21a14f5c8a5645c4d79e2aaf09ca8c566b6a7
Title: Unclear docs on MacTypes in tk_getOpenFile
Type: Bug Version:
Submitter: karelbilek Created on: 2025-04-22 12:50:36
Subsystem: 37. File System Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2025-04-22 13:09:40
Resolution: Rejected Closed By: oehhar
    Closed on: 2025-04-22 13:09:40
Description:

The tk_getOpenFile docs seem outdated and unclear about MacTypes.

The docs say

On the Macintosh platform, a file matches a file pattern if its name matches at least one of the extension(s) AND it belongs to at least one of the macType(s) of the file pattern. For example, the C Source Files file pattern in the sample code matches with files that have a -c extension AND belong to the macType TEXT. To use the OR rule instead, you can use two file patterns, one with the extensions only and the other with the macType only. The GIF Files file type in the sample code matches files that EITHER have a -gif extension OR belong to the macType GIFF.

On the Unix and Windows platforms, a file matches a file pattern if its name matches at at least one of the extension(s) of the file pattern. The macTypes are ignored.

I have figured out Macintosh here is not OS X - which is Unix - but OS 9. Which makes the docs obsolete, OS X is 20 years old at this point, and it is using UTIs since around Snow Leopard (around 2006).

I have not figured out what to do on OS X, how to properly call this. It seems the macType is still needed? I have figured out PDFs, for example, used to have four letter code "PDF " (with the space), but I cannot pass that to tk_getOpenFile?

User Comments: oehhar added on 2025-04-22 13:09:40:
Moved to tk ticket [https://core.tcl-lang.org/tk/tktview/1a15f7cc4d364cb91d22149c25e9c0d52dcef0aa]