0

I have a mac app and want to hide it's resources. On windows, I simply made a resource file, but those don't seem to be existent on Mac. So I decided to follow the advice of this link.

What I'm going to do, in another application which will prepare the resources beforehand, is take ALL my resources (text files, images, sound files, etc) and convert them each to CFData objects. Then I'm going to store them in a CFDictionary object with the filename as the key. After that, I'm going to save the dictionary to a file.

Problem is, CFDictionary objects don't know how to archive themselves, and I can't use Foundation objects, just Core Foundation. Is there a way to convert a CFDictionary to a char* and save that? Or will I have to save the keys and values individually and read them later to recreate a CFDictionary? If so, how would I convert the CFData objects?

Community
  • 1
  • 1
rcplusplus
  • 2,767
  • 5
  • 29
  • 43
  • I made a software just for that with optional AES256 encryption, developer tools to decrypt in Xcode are inside the app Enjoy! http://www.macupdate.com/app/mac/55122/loot-locker – Coldsteel48 Aug 08 '15 at 18:25

1 Answers1

1

I found this interesting page which has a utility method for converting a CFDictionary to CFData:

inline CFDataRef makeCFData(CFDictionaryRef dictionary)
{
    return CFPropertyListCreateXMLData(NULL, dictionary);
}

I don't know if it would work with images and sounds, though. You may have to convert those to CFDatas first.

user1118321
  • 25,567
  • 4
  • 55
  • 86