Setting an icon to my Application custom file

Eureka.

After years of research, I finally found how to do that with my Xojo version: “à l’ancienne” . :wink:

First of all, I will disclose how I do it for json files and it worked fine (even if the file is an sqlite3 file internally):

Display name: JSON Document (JSON)
Object name: JSON
MacType: JSON
MacCreator: TEXT
Extensions: .json
UTIs: public.json
Icon: a custom icon was provided.

Yes, I know, some properties above are deprecated.

In the macOS File Types, I set Editor for that file type.

Firefox have an icon for json files, but my custom icon is used.
BETTER: when I change the file extension (of a .sqlite file), the json icon is immediately set / removed when I removed the .json file extension. So far, so good.

During years, here and then, I tried to change my .sqlite file definition to no available.

Minutes ago, I found my solution:
MacType and MacCreator set to ???
UTIs: nothing (empty).
File Extensions: .sqlite
macOS File Type set to Editor

Process
Application build,
Quit Xojo,
Shut down,
Reboot,
Open the Builds folder…

SURPRISE: I get my custom icon.

How do I achieve that (think to do that) ?
The solution came to me when I was thinking: “I’ve done everything.”
Then: “No, I do not let blank some parts”.
So I removed the UTIs, PROCESS…
I fill MacType and MacCreator with ???, PROCESS…
…and it worked.

Do not “Ask Me Why” this works.

FWIW.

Are you sure this is the correct UTI? Modern file associations are done via UTI, so when registering for third party files, you need to verify that you’re using the correct UTI.

Hi Sam,

I found it at Apple. And this works fine *.

  • Excepted that I either forgot to write the code to read/write OR forget to call the code to Read/Write JSON files ;).

On the same (last paragraph above): I found a bug in my code Paste from Clipboard. This was tested andtested; if one asked me … I would say “this part is rock solid” !!! The bug stays in Paste in a Column when there is not enough Rows in the documents (or too many lignes in the Clipboard…). Even when you are sure you envisioned all case, one (or more) is forgotten :wink:

Having fun with programming. :wink:

I just wrote about this here.

Lol… imagine my bewilderment when at the vets, and they start going on about my dog having a UTI… Eh? Oh not that kind of UTI.

Oh when I’m talking about STI, and someone eavesdropping at the party goes… eurgh that’s gross…

Isn’t that STD and not STI?

One is a disease and one is an infection. And the one I mean is International!

Hi Greg,

yes, I read that entry.

In fact I have to thank you for your contribution there: it help me searching (I tried application’ com.xxx…) and that was the start of the new round that leads me to find how to do it to get the icon.

Nota: I was surprised earlier today when I had my nice icon in front of my eye !
Yes, custom icons are great.

BTW: here are some entries that gives the UTI (and an icon) for JSON files:

Most notable entries are:"

"https://www.oreilly.com/library/view/learning-swift-2nd/9781491967058/ch04.html

Both gives the UTI for json files (and more for the Apple site).

You can also get the UTI, by opening Terminal, type "mdls " and then drag a file into the window, and press return.

mdls ~/Desktop/test.json returns

“public.json”

So you had indeed gotten the correct UTI, sorry for wasting your time and the noise.

You’re welcome.