Hi,
When I apply IIcon->GetDiskObject() or IIcon->GetDiskObjectNew(), I *MAY* get a valid pointer to a struct DiskObject (or not in case of a failure).
How can I figure out from that struct DiskObject whether there was indeed a valid '.info'-file present (GetDiskObject() was successfull), or there was no '.info'-file present (GetDiskObject() failed, but GetDiskObjectNew() was succesfull)?
OldFart
If you get a valid struct DiskObject then you can check some of its do_#? values, maybe do_Magic (WB_DISKMAGIC 0xe310 /* a magic number, not easily impersonated */)
Taken from autodocs:
GetDiskObjectNew()
...
This call is functionally identical to GetDiskObject() with one exception. If its call to GetDiskObject() fails, this function calls GetDefDiskObject().
---
GetDefDiskObject()
...
This routine reads in a default Workbench disk object from disk. The valid def_types can be found in workbench/workbench.h and...
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonRX550/SSD240GB/DVDRW :-P
You should avoid old Kick 2.0 functions. Have a look at GetIconTagList() and IconControl(). At least one of them has an IsDefaultIcon tag which holds the desired information.
I don't see a way to exactly do it. While it looks neat to combine them you may have to split them up into separate function calls.
But using IDOS->IoErr() is also an obvious one as well in case it failed. So you can find exactly why and check for ERROR_OBJECT_NOT_FOUND as an example. Indicating no info file found.
You might need to try GetDiskObject() first and if it fails call GetDefDiskObject() or GetDiskObjectNew() even. But it doesn't state what type it uses as default. If you know what type you want that won't matter.
@thomas
Changed my code accordingly. GetIconTags() fully met my requirements.
Thank you.
OldFart