Ticket UUID: | 1a15f7cc4d364cb91d22149c25e9c0d52dcef0aa | |||
Title: | Unclear docs on MacTypes in tk_getOpenFile (patch included) | |||
Type: | Bug | Version: | ||
Submitter: | oehhar | Created on: | 2025-04-22 13:08:47 | |
Subsystem: | 37. [tk_get*File] | Assigned To: | nobody | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Open | Last Modified: | 2025-04-24 13:48:00 | |
Resolution: | None | Closed By: | nobody | |
Closed on: | ||||
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? (from tcl ticker: https://core.tcl-lang.org/tcl/info/fd21a14f5c8a5645) | |||
User Comments: |
karelbilek added on 2025-04-24 13:48:00:
In that case, the whole paragraph can be radically shortened? I tried something. marc_culler (claiming to be Marc Culler) added on 2025-04-24 13:02:42: The patch looks fine to me, as far as it goes, but I wonder if there should be some further edits. The manual page, even after the changes that you are proposing, suggests that it might be possible to build the current version of Tk on a Macintosh OS 9 system. That is not possible. The current code depends heavily on Cocoa, which did not exist for OS 9. In the recent discussion about which systems are officially supported by Tk I was making the case that OSX 10.13 should be the oldest supported Apple OS. karelbilek added on 2025-04-24 10:30:39: I have attached a simple patch for docs. I have never used fossil before; this is a result of anonymous (claiming to be Karel Bilek) added on 2025-04-24 09:23:03: (I hope I am replying correctly) I think it's mostly a documentation issue, it didn't actually cause any problem for me (at first I thought it did, but I have been using tk_getOpenFile wrong) and I was very confused. Thanks for this clarifying comment. marc_culler (claiming to be Marc Culler) added on 2025-04-22 22:11:02: Yes, the 32-bit "creator code" and "type code" types predate mac OSX. The creator code is now ignored wherever it occurs and as far as I know the old Apple creator code registry is no longer functioning, but still exists in some undocumented frozen configuration. The type codes have been essentially (but sort of half-heartedly) replaced by file extensions in macOS. But the type codes are still supported at some very low level for some mysterious reason. The main remnant is that a type code can be used to specify the official system icon to be used for a specific file type. The Tk code for dealing with file types (along with quite a bit of history and some discussion of related topics like Uniform Type Identifiers) is contained in the file tkMacOSXFileTypes.c. I would recommend starting with that file if you want to see how type codes fit into Tk and get an idea of how much work and how much breakage would be involved in removing them from Tk. Are type codes causing a problem for anyone, or is this just interesting because it indicates how long Tk has been around? anonymous added on 2025-04-22 13:21:10: It seems the MacType is actually NOT needed at all at OS X and I was wrong; so the issue is only with docs; it's not entirely clear that "Macintosh" here refers to OS 9 only (which is... maybe not supported anymore? Not sure) |
