From: Richard C. <rd_...@sb...> - 2003-12-02 19:39:17
|
Andrew wrote: >=A0My ideal for MacOS X would be for any .zas file to compile down to >=A0a .zao file that's placed appropriately in the bundle. That's the >=A0bit I haven't learned enough about to have done anything yet. Then >=A0we can update ZUtil_Asset so that ZUtil_Asset:: >=A0sGetAssetTreeNamesFromExecutable can return a list of all the .zaos >=A0in that location. Here's the code to find all the .zao files and generate absolute paths (as= null-terminated strings): #include <sys/syslimits.h> // for PATH_MAX CFBundleRef mainBundle =3D CFBundleGetMainBundle(); CFArrayRef childURLs =3D CFBundleCopyResourceURLsOfType(mainBundle,= CFSTR("xao"), NULL); CFIndex count =3D CFArrayGetCount(); CFIndex index; for (index =3D 0; index < count; index++) { =09char buffer[PATH_MAX]; CFURLRef url =3D CFArrayGetValueAtIndex(childURLs, index); CFURLGetFileSystemRepresentation(url, true, buffer, PATH_MAX); // ...use the absolute path in buffer here... } CFRelease(childURLs); // we were given a copy of these so we should mark as= free when done. // Do not release the main bundle or URLs extracted from the child array --= mainBundle is a singleton, owned by the system // and each extracted url is just a pointer within the childURLs array > And as we have the POSIX APIs available, >=A0ZUtil_Asset::sGetAssetTreeFromExecutable can be updated to do what >=A0we do on POSIX -- mmap the file. Absolutely. Some people have had a problem with mmap() and large files= causing excessive paging; the problem and its solution are discussed at= <http://www.omnigroup.com/mailman/archive/macosx-dev/2003-June/034512.html>= > >=A0A+ ...R |