Open with functionality

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By EnrikeChurin

I’m creating a retro console with Godot, and I want to have a open with functionality. Specifically to drop a file onto executable in file manager, or right click a file, open with “retro console” or something.

This is not a question, especially “or something” part.

sash-rc | 2021-08-27 19:59

That is a question!

how would open with functionality look

EnrikeChurin | 2021-08-27 20:52

I wrote “or something” cos there was no picture or other clear description. It could be implemented differently, but the idea is the same.

EnrikeChurin | 2021-08-27 20:53

Well, then the question does not relates to a Godot, and it’s very platform-dependent.

Google, how to handle file-associations in OS’ shell where you want to deploy your application.

sash-rc | 2021-08-27 22:05

I thought that Godot might have this functionality built-in.
For me working with Godot doesn’t mean doing anything such low-level, it isn’t made for that. Recompiling the engine is not an option, I can only use gdscript and whatever Godot has to offer.

EnrikeChurin | 2021-08-27 22:08

It very much relates to Godot, if not I would have put this question here. Difference working with native tooling and Godot is that I don’t have to do what you said I need to do. Rather it’s just there.

EnrikeChurin | 2021-08-27 22:10

You’re opening file (your made-in-Godot executable) from the file manager (not your executable).
It’s a question about file manager, not Godot.

sash-rc | 2021-08-27 22:27

:bust_in_silhouette: Reply From: Wakatta

What is your targeted OS?

If windows that information is stored in the regristry and you can set it using Godot’s OS.execute() with a VB or PoweShell script. A neat trick would be to do the file association on your PC then in the registry editor do a search for your game name then export the .reg file which you can later use for the distribution of your game by resetting it.

Have not used windows since v7 but it used to be somewhere inHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorerand may have changed in recent years

Can the similar thing be done for Linux and macOS?

EnrikeChurin | 2021-08-27 22:46

Yes Linux is much simpler Simply create a .desktop file and assign the mime type, can’t remember how Apple products operate but it gets autoset, similarly Android has an Intent filter located in the AndroidManifest file

Wakatta | 2021-08-27 23:13