Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
134 user(s) are online (117 user(s) are browsing Forums)

Members: 0
Guests: 134

more...

Support us!

Headlines

 
  Register To Post  

How to determine file types in C++ & AOS4?
Just popping in
Just popping in


See User information
Is there something like 'libmagic.so' (from linux) with extensions for Amiga specific files, like icons, PagesStream files, YAM mails, etc? Would be handy. Maybe porting libmagic would be nice and then extending it would be even more nice

regards,
nexus

Go to top
Re: How to determine file types in C++ & AOS4?
Supreme Council
Supreme Council


See User information
@nexus

OS4 has deficons built in. From 4.1 there's API calls you can use to get the file type.

Perhaps deficons can get you where you want.

IIcon->GetIconTags(path,
        
ICONGETA_IdentifyOnly,TRUE,
        
ICONGETA_IdentifyBufferbufTAG_DONE);

Vacca foeda. Sum, ergo edo

Mr Bobo Cornwater
Go to top
Re: How to determine file types in C++ & AOS4?
Just popping in
Just popping in


See User information
@orgin

ah, thanks, yes, I think that does the job and it's more amiga like than porting libmagic (which should be straight forward) and trying to extend it to recognize amiga specific file types.

thanks,
nexus

Edit: eh, wait. Does this only work if the file in question has an appropriate icon attached (because of IIcon->..)? What about files without icons?

Thanks again,
nexus

Edit again: Most likely, the "default icon"-setup kicks in. I will try it sooner or later :)

Thanks, the third!
nexus

Go to top
Re: How to determine file types in C++ & AOS4?
Supreme Council
Supreme Council


See User information
@nexus

The file does not need to have an icon.

Vacca foeda. Sum, ergo edo

Mr Bobo Cornwater
Go to top
Re: How to determine file types in C++ & AOS4?
Amigans Defender
Amigans Defender


See User information
@nexus

You can use DataTypes as well:

dtn = ObtainDataTypeA (DTST_FILE, (APTR)lock, NULL)
dth = dtn->dtn_Header;

Then examine:
dth->dth_GroupID
dth->dth_Name


It really depends what you are wanting to use the filetyping for as to which is better for you, thanks to our stupid non-integrated filetyping system.

Go to top
Re: How to determine file types in C++ & AOS4?
Just can't stay away
Just can't stay away


See User information
@nexus

Also, don't forget that relying on file name extensions to determine the functional (expected) contents of a file is a risky business. One which is luckily usually not necessary in AmigaOS (as illustrated above).

Best regards,

Niels

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 2 ( 0 members and 2 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project