Question about struct DiskObject (solved)

5 posts / 0 new
Last post
OldFart
OldFart's picture
Offline
Last seen: 5 hours 26 min ago
Joined: 2010-11-30 14:09
Question about struct DiskObject (solved)

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

jabirulo
jabirulo's picture
Offline
Last seen: 2 days 14 hours ago
Joined: 2013-05-30 00:53
Re: Question about struct DiskObject

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

thomas
thomas's picture
Offline
Last seen: 23 hours 4 min ago
Joined: 2011-05-16 14:23
Re: Question about struct DiskObject

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.

hypex
hypex's picture
Offline
Last seen: 1 week 3 days ago
Joined: 2011-09-09 16:20
Re: Question about struct DiskObject

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.

OldFart
OldFart's picture
Offline
Last seen: 5 hours 26 min ago
Joined: 2010-11-30 14:09
Re: Question about struct DiskObject

@thomas

Changed my code accordingly. GetIconTags() fully met my requirements.

Thank you.

OldFart

Log in or register to post comments