Skip to content
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

UTIs when setting app defaults #5238

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

svobs
Copy link
Contributor

@svobs svobs commented Oct 29, 2024


Description:

As noted in #5199, IINA's Set as Default feature currently associates itself with Typescript files. As a developer, this is rather embarrassing.

It does this because the ts file extension is used both for "transport stream" & "typescript" types.

Background: MacOS associates each file with a single Uniform Type Identifier. Unfortunately there can be many UTIs for a given file format (e.g. some UTIs for a FLAC file include io.iina.flac and io.mpv.flac) because each app may register its own UTI for it and may choose to associate it with the file when it is created. In addition, each UTI may be associated with multiple filename extensions (e.g. flac), but each filename extension can also have multiple associated UTIs.

To change the defaults, IINA currently starts with its list of "import UTIs" (e.g., io.iina.mpeg-stream, finds all the associated extensions (m2p, ps, ts, m2ts, mts, mt2s) then finds all the UTIs associated with each extension. But that last step yields some unwanted UTIs.

I analyzed the current search for UTIs, and found that modifying the last step in the search to be a subtype of audiovisual-content gets us nearly there. But 2 of IINA's 34 "import" UTIs do not: io.iina.cue & io.iina.playlist. I could not find a better way to search for them other than to manually include them. (I tried conformance to playlist, but that added many unrelated types).

In my testing, this results in 115 associations instead of 118. The following become omitted:

  • com.microsoft.typescript
  • com.adobe.postscript
  • com.real.ram

See attached test results below.

Defaults-Before-snippit.log
Defaults-After-snippit.log

Also note: this fix currently only works for MacOS 11+ because it's not clear how to fix the legacy code path. Maybe just explicitly removing com.microsoft.typescript from the search results would be good enough.

@svobs svobs force-pushed the pr-refine-default-filetypes branch from 0336809 to 7c7f920 Compare October 29, 2024 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant