Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Type/Creator in Cocoa

Type/Creator in Cocoa
Thread Tools
Mac Elite
Join Date: Sep 2000
Status: Offline
Reply With Quote
Aug 5, 2001, 04:51 AM
 
I'm writing a cocoa app that needs to be able to detect a file's type and creator codes, but I've hit a wall. I've found sources that say that this is currently only available with Carbon; yet, there was a Cocoa app called Cocoa Type Changer that came with source code that did exactly what I need. It was located at http://www.merespass.net/software.shtml but that server has disappeared.

Does anyone have the code from this app?
Or does anyone here know how to access and modify this info in Cocoa?
The server made a boo boo. (403)
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status: Offline
Reply With Quote
Aug 5, 2001, 11:09 AM
 
There seems to be a DNS problem with that hostname; but if you go to the registered primary DNS server for that domain you'll find its IP is 146.115.208.16, and you can use that to connect.

Source code doesn't seem to be available though.

To get the file type, you can use the NSHFSTypeOfFile() function in Foundation/NSHFSFileTypes.h. I'm not sure about creator though. The app in question does link against Carbon, and seems to reference the FSGetCatalogInfo(), FSPathMakeRef(), FSpGetFInfo(), FSpSetFInfo(), LSCopyItemInfoForURL(), LSCopyKindStringForURL(), LSGetApplicationForInfo(), and LSInit() functions. Not sure which of those (if any) are used in getting the creator though.
     
Forum Regular
Join Date: Aug 2001
Location: Vienna, Austria
Status: Offline
Reply With Quote
Aug 6, 2001, 07:13 AM
 
Those HFS-calls won't work on NFS/UFS/MSDOS/WEBDAV-devices (Carbon emulates those features on single-forked disks).

But implementing Carbon calls into Cocoa isn't that complicated. Just add Carbon.framework to your framework, #include <Carbon/Carbon.h> and use the functions you want.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Aug 6, 2001, 01:10 PM
 
Originally posted by amonitzer:
<STRONG>Those HFS-calls won't work on NFS/UFS/MSDOS/WEBDAV-devices (Carbon emulates those features on single-forked disks).

But implementing Carbon calls into Cocoa isn't that complicated. Just add Carbon.framework to your framework, #include &lt;Carbon/Carbon.h&gt; and use the functions you want.</STRONG>
And for less bloat just add CoreServices (which includes CarbonCore and therefore Files.h and everything you should need).
     
Fresh-Faced Recruit
Join Date: Aug 2001
Location: California
Status: Offline
Reply With Quote
Aug 12, 2001, 04:10 PM
 
I contacted marc and he gave me the source[/LIST]
AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:22 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2