Find default app

4 posts / 0 new
Last post
mritter0
mritter0's picture
Offline
Last seen: 2 years 5 months ago
Joined: 2014-04-21 21:15
Find default app

Let's say I have an LhA archive, how to I find out the path to the default archive program (Sys:C/Unarc)? File does not have an icon associated with it. Same for any file type: PNG, MP3, JPG, etc.

Is there a place in the OS to look it up with system functions? Or do I have to look at the ENVARC:Sys/def_XXX.info to get it?

hypex
hypex's picture
Offline
Last seen: 3 months 2 weeks ago
Joined: 2011-09-09 16:20
Re: Find default app

So essentially you want to find the default tool without an icon that would have the default tool?

You may be right. You may have to look it up as def icon. You can use GetDiskObject() from icon.library to open a def icon and get at the default tool easier.

Or even try GetDefDiskObject() by itself. Also GetDiskObjectNew() could be attempted on the file at hand as this tries to locate a default tool if it has no icon. But I don't know how well it would work for the types of files you need it for.

thomas
thomas's picture
Offline
Last seen: 3 months 1 week ago
Joined: 2011-05-16 14:23
Re: Find default app

If you want to find the tool for a given file, then GetDiskObjectNew or rather GetIconTags with FailIfUnavailable=FALSE is the way to go. The default tool of the disk object will point to the tool.

If you want to find the tool for a given file type, you can just GetIconTags(NULL,ICONGETA_GetDefaultName,type). Again the default tool is where to look at.

If you neither know the file type nor have a file, then you are lost. You could check deficons prefs, but there is no public function for that. The structure of the file is documented somewhere, though. I think the docs are in the NewIcons archive on Aminet.

mritter0
mritter0's picture
Offline
Last seen: 2 years 5 months ago
Joined: 2014-04-21 21:15
Re: Find default app

I didn't think I was missing a system call. That was how I figured it had to be done.

Thanks

Log in or register to post comments