这篇教程C++ CFBundleCopyResourceURL函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CFBundleCopyResourceURL函数的典型用法代码示例。如果您正苦于以下问题:C++ CFBundleCopyResourceURL函数的具体用法?C++ CFBundleCopyResourceURL怎么用?C++ CFBundleCopyResourceURL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CFBundleCopyResourceURL函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: hu_XMLLoad/************************************************************************* * * hu_XMLLoad( inResourceName, inResourceExtension ) * * Purpose: Load a resource( XML ) file into a CFPropertyListRef * * Inputs: inResourceName - name of the resource file * inResourceExtension - extension of the resource file * * Returns: CFPropertyListRef - the data */static CFPropertyListRef hu_XMLLoad(CFStringRef inResourceName, CFStringRef inResourceExtension) { CFURLRef resFileCFURLRef; CFPropertyListRef tCFPropertyListRef = NULL; // check the main (application) bundle resFileCFURLRef = CFBundleCopyResourceURL(CFBundleGetMainBundle(), inResourceName, inResourceExtension, NULL); if ( !resFileCFURLRef ) { // check this specific (HID_Utilities framework) bundle CFBundleRef tCFBundleRef = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.HID_Utilities")); if ( tCFBundleRef ) { resFileCFURLRef = CFBundleCopyResourceURL( tCFBundleRef, inResourceName, inResourceExtension, NULL ); } } if ( !resFileCFURLRef ) { // check bundles already loaded or otherwise known to the current process CFArrayRef tCFArrayRef = CFBundleGetAllBundles(); CFIndex idx, cnt = CFArrayGetCount(tCFArrayRef); for ( idx = 0; idx < cnt; idx++ ) { CFBundleRef tCFBundleRef = (CFBundleRef) CFArrayGetValueAtIndex(tCFArrayRef, idx) ; if ( tCFBundleRef ) { resFileCFURLRef = CFBundleCopyResourceURL( tCFBundleRef, inResourceName, inResourceExtension, NULL ); if ( resFileCFURLRef ) { break; } } } } if ( resFileCFURLRef ) { tCFPropertyListRef = hu_LoadFromXMLFile(resFileCFURLRef); CFRelease(resFileCFURLRef); } return (tCFPropertyListRef);} // hu_XMLLoad
开发者ID:CarlKenner,项目名称:gz3doom,代码行数:46,
示例2: RemotePluginClientRemoteVSTClient::RemoteVSTClient(CFBundleRef bundle, audioMasterCallback theMaster, AEffect *theEffect, bool showGUI) : RemotePluginClient(theMaster, theEffect){ m_bundle = bundle; m_audioMaster = theMaster; pid_t child; SInt32 errorCode; CFDataRef data; CFURLRef configUrl = CFBundleCopyResourceURL(bundle, CFSTR("config"), CFSTR("plist"), NULL); if (configUrl == 0) { return; } CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, configUrl, &data, NULL, NULL, &errorCode); m_props = (CFDictionaryRef) CFPropertyListCreateFromXMLData( kCFAllocatorDefault, data, kCFPropertyListImmutable, NULL); std::string dllName(CFStringGetCStringPtr(get_path_prop(CFSTR("plugin-name")), NULL)); std::string arg = dllName + "," + getFileIdentifiers(); if (showGUI) arg = "-g " + arg; const char *argStr = arg.c_str(); CFURLRef server_url = CFBundleCopyResourceURL(m_bundle, CFSTR("dssi-vst-server.exe"), CFSTR("so"), NULL); if (server_url != NULL) { CFStringRef server_path = CFURLCopyFileSystemPath(server_url, kCFURLPOSIXPathStyle); if (server_path != NULL) { const char *c_server_path = CFStringGetCStringPtr(server_path, NULL); CFStringRef wine_path = (CFStringRef) CFDictionaryGetValue(m_props, CFSTR("wine-path")); if (wine_path != NULL) { const char *c_wine_path = CFStringGetCStringPtr(wine_path, NULL); std::cerr << "RemoteVSTClient: executing " << c_server_path << "/n"; // if no dispaly environment guess... // setenv("DISPLAY", ":0", 0); setenv("DYLD_FALLBACK_LIBRARY_PATH", "/usr/X11/lib:/usr/lib", 0); if ((child = fork()) < 0) { cleanup(); throw((std::string)"Fork failed"); } else if (child == 0) { // child process if (execlp(c_wine_path, "wine", c_server_path, argStr, NULL)) { perror("Exec failed"); exit(1); } } syncStartup(); return; } } } cleanup(); throw((std::string)"Failed to find dssi-vst-server executable"); return; }
开发者ID:griels,项目名称:wacvst,代码行数:51,
示例3: _bTrace_// ---------------------------------------------------------------------------// A PLACER DANS STYLEMGR// ------------bool bMacMapType::make_style(){_bTrace_("bMacMapType::make_style",false);char path[PATH_MAX];CFURLRef url; switch(_kind){ case kBaseKindPoint: url=CFBundleCopyResourceURL(CFBundleGetMainBundle(),CFSTR("default_point_style"),CFSTR("xml"),NULL); break; case kBaseKindPolyline: url=CFBundleCopyResourceURL(CFBundleGetMainBundle(),CFSTR("default_line_style"),CFSTR("xml"),NULL); break; case kBaseKindText: url=CFBundleCopyResourceURL(CFBundleGetMainBundle(),CFSTR("default_text_style"),CFSTR("xml"),NULL); break; case kBaseKindPolygon: url=CFBundleCopyResourceURL(CFBundleGetMainBundle(),CFSTR("default_surf_style"),CFSTR("xml"),NULL); break; case kBaseKindRaster: url=CFBundleCopyResourceURL(CFBundleGetMainBundle(),CFSTR("default_raster_style"),CFSTR("xml"),NULL); break; default:_te_("bad type kind "+_kind); return(false); break; } if(!url){_te_("url == NULL"); return(false); } CFStringRef cfs=CFURLCopyFileSystemPath(url,kCFURLPOSIXPathStyle); CFRelease(url); CFStringGetCString(cfs,path,PATH_MAX,kCFStringEncodingMacRoman); CFRelease(cfs);void* buffer;int sz;bStdFile stl(path,"r"); if(stl.status()){_te_("stl.status()="+stl.status()); return(false); } stl.mount((char**)&buffer,&sz); _bse.set_param("styles","default.xml",buffer,sz); free(buffer); return(true);}
开发者ID:CarteBlancheConseil,项目名称:MacMap,代码行数:52,
示例4: getFrameworkFromBundlestatic string getFrameworkFromBundle(){ // Attempt to locate the Firebird.framework bundle CFBundleRef fbFramework = CFBundleGetBundleWithIdentifier(CFSTR(DARWIN_FRAMEWORK_ID)); if (fbFramework) { CFURLRef msgFileUrl = CFBundleCopyResourceURL(fbFramework, CFSTR(DARWIN_GEN_DIR), NULL, NULL); if (msgFileUrl) { CFStringRef msgFilePath = CFURLCopyFileSystemPath(msgFileUrl, kCFURLPOSIXPathStyle); if (msgFilePath) { char file_buff[MAXPATHLEN]; if (CFStringGetCString(msgFilePath, file_buff, MAXPATHLEN, kCFStringEncodingMacRoman)) { string dir = file_buff; dir += PathUtils::dir_sep; return dir; } } } } // No luck return "";}
开发者ID:Alexpux,项目名称:firebird,代码行数:29,
示例5: ios_open_from_bundlestatic FILE* ios_open_from_bundle(const char path[], const char* perm) { // Get a reference to the main bundle CFBundleRef mainBundle = CFBundleGetMainBundle(); // Get a reference to the file's URL CFStringRef pathRef = CFStringCreateWithCString(NULL, path, kCFStringEncodingUTF8); CFURLRef imageURL = CFBundleCopyResourceURL(mainBundle, pathRef, NULL, NULL); CFRelease(pathRef); if (!imageURL) { return nullptr; } // Convert the URL reference into a string reference CFStringRef imagePath = CFURLCopyFileSystemPath(imageURL, kCFURLPOSIXPathStyle); CFRelease(imageURL); // Get the system encoding method CFStringEncoding encodingMethod = CFStringGetSystemEncoding(); // Convert the string reference into a C string const char *finalPath = CFStringGetCStringPtr(imagePath, encodingMethod); FILE* fileHandle = fopen(finalPath, perm); CFRelease(imagePath); return fileHandle;}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:25,
示例6: fopen FILE* fopen (const char *filename, const char *mode) { #ifdef HX_MACOS FILE *result = ::fopen (filename, "rb"); if (!result) { CFStringRef str = CFStringCreateWithCString (NULL, filename, kCFStringEncodingUTF8); CFURLRef path = CFBundleCopyResourceURL (CFBundleGetMainBundle (), str, NULL, NULL); CFRelease (str); if (path) { str = CFURLCopyPath (path); CFIndex maxSize = CFStringGetMaximumSizeForEncoding (CFStringGetLength (str), kCFStringEncodingUTF8); char *buffer = (char *)malloc (maxSize); if (CFStringGetCString (str, buffer, maxSize, kCFStringEncodingUTF8)) { result = ::fopen (buffer,"rb"); free (buffer); } CFRelease (str); CFRelease (path); } } return result; #else return ::fopen (filename, mode); #endif }
开发者ID:GumbertGumbert,项目名称:lime,代码行数:26,
示例7: UnloadBundlevoid UnloadBundle(CFBundleRef theBundle){ /*get bundle resource and convert from xml to propertylist struct so we can look for revdontunload attribute and not unload- necessary for external that interface with Cocoa*/ Boolean dontunload = False; CFPropertyListRef tCFPropertyListRef = NULL; short resrefnum = CFBundleOpenBundleResourceMap (theBundle ); CFURLRef resFileCFURLRef = CFBundleCopyResourceURL(theBundle,CFSTR("revinfo"),CFSTR("plist"),NULL); CFDataRef resCFDataRef; if (resFileCFURLRef && CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault,resFileCFURLRef,&resCFDataRef,nil,nil,nil)) { if (resCFDataRef) { CFStringRef errorString; tCFPropertyListRef = CFPropertyListCreateFromXMLData(kCFAllocatorDefault,resCFDataRef,kCFPropertyListImmutable,&errorString); CFRelease(resCFDataRef); } } if (tCFPropertyListRef) { if (CFDictionaryGetValueIfPresent((CFDictionaryRef)tCFPropertyListRef,CFSTR("revdontunload"),NULL)) dontunload = True; } if (resFileCFURLRef) CFRelease(resFileCFURLRef); CFBundleCloseBundleResourceMap (theBundle,resrefnum); if (theBundle && !dontunload) { CFBundleUnloadExecutable(theBundle); CFRelease(theBundle); }}
开发者ID:Bjoernke,项目名称:livecode,代码行数:32,
示例8: xml_load// ---------------------------------// Load the element strings from the given resource (XML) file into a CFPropertyListRefstatic CFPropertyListRef xml_load(const CFStringRef pResourceName,const CFStringRef pResourceExtension){ CFPropertyListRef tCFPropertyListRef = NULL; CFURLRef resFileCFURLRef = CFBundleCopyResourceURL(CFBundleGetMainBundle(), pResourceName, pResourceExtension, NULL); if (NULL != resFileCFURLRef) { CFDataRef resCFDataRef; if (CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, resFileCFURLRef, &resCFDataRef, nil, nil, nil)) { if (NULL != resCFDataRef) { CFStringRef errorString; tCFPropertyListRef = CFPropertyListCreateFromXMLData(kCFAllocatorDefault, resCFDataRef, kCFPropertyListImmutable, &errorString); if (NULL == tCFPropertyListRef) CFShow(errorString); CFRelease(resCFDataRef); } } CFRelease(resFileCFURLRef); } return tCFPropertyListRef;}
开发者ID:AlanFreeman,项目名称:Psychtoolbox-3,代码行数:27,
示例9: getPropertyListstatic CFPropertyListRef getPropertyList(){ CFDataRef xmlData; CFStringRef error; CFPropertyListRef propertyList; CFBundleRef appBundle; CFURLRef myRef; // locate the starter's bundle: appBundle = CFBundleGetMainBundle(); // get a URL for the named resource myRef = CFBundleCopyResourceURL(appBundle, CFSTR(RSRCNAME), NULL, NULL); if (myRef == NULL) { return NULL; } // Load the XML data using its URL. CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, myRef, &xmlData, NULL, NULL, NULL); // convert to a Property List propertyList = CFPropertyListCreateFromXMLData(kCFAllocatorDefault, xmlData, kCFPropertyListImmutable, &error); if (error != NULL) { return NULL; } return propertyList;}
开发者ID:akavel,项目名称:pltscheme-cvs-cvs2git-1,代码行数:32,
示例10: path_to_filechar const* path_to_file(CFStringRef file, CFStringRef extension){ // Get a reference to the main bundle CFBundleRef mainBundle = CFBundleGetMainBundle(); if (mainBundle == NULL) { return NULL; } // Get a reference to the file's URL CFURLRef imageURL = CFBundleCopyResourceURL(mainBundle, file, extension, NULL); if (imageURL == NULL) { return NULL; } // Convert the URL reference into a string reference CFStringRef imagePath = CFURLCopyFileSystemPath(imageURL, kCFURLPOSIXPathStyle); // Get the system encoding method CFStringEncoding encodingMethod = CFStringGetSystemEncoding(); // Convert the string reference into a C string const char *path = CFStringGetCStringPtr(imagePath, encodingMethod); return path;}
开发者ID:samds,项目名称:OGLUIKit,代码行数:30,
示例11: CFBundleCopyResourceURL//----------------------------------------------------------------------------//const char* CEGuiBaseApplication::getDataPathPrefix() const{ static char dataPathPrefix[PATH_MAX];#ifdef __APPLE__ CFURLRef datafilesURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("datafiles"), 0, 0); CFURLGetFileSystemRepresentation(datafilesURL, true, reinterpret_cast<UInt8*>(dataPathPrefix), PATH_MAX); CFRelease(datafilesURL);#else char* envDataPath = 0; // get data path from environment var envDataPath = getenv(DATAPATH_VAR_NAME); // set data path prefix / base directory. This will // be either from an environment variable, or from // a compiled in default based on original configure // options if (envDataPath != 0) strcpy(dataPathPrefix, envDataPath); else strcpy(dataPathPrefix, CEGUI_SAMPLE_DATAPATH);#endif return dataPathPrefix;}
开发者ID:kphillisjr,项目名称:cegui,代码行数:31,
示例12: CreateSceneint CreateScene() { CFURLRef balls_dat_url = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("balls"), CFSTR("dat"),NULL); char filename[1024]; CFURLGetFileSystemRepresentation(balls_dat_url, true, (UInt8*)filename, (CFIndex)sizeof(filename)); CFRelease(balls_dat_url); global_scene = rt_newscene(); rt_initialize(); if ( readmodel(filename, global_scene) != 0 ) { rt_finalize(); return -1; } // need these early for create_graphics_window() so grab these here... scenedef *scene = (scenedef *) global_scene; get_screen_resolution(&global_xsize, &global_ysize); // scene->hres and scene->vres should be equal to screen resolution scene->hres = global_xwinsize = global_xsize; scene->vres = global_ywinsize = global_ysize; return 0;}
开发者ID:BigR-Lab,项目名称:CodeRes_Cpp,代码行数:25,
示例13: _bs_main_bundle_bs_pathstatic inline const char *_bs_main_bundle_bs_path(void){ static bool done = false; static char *path = NULL; /* XXX not thread-safe */ if (!done) { CFBundleRef bundle; done = true; bundle = CFBundleGetMainBundle(); if (bundle != NULL) { CFURLRef url; url = CFBundleCopyResourceURL(bundle, CFSTR("BridgeSupport"), NULL, NULL); if (url != NULL) { CFStringRef str = CFURLCopyPath(url); path = (char *)malloc(sizeof(char) * PATH_MAX); ASSERT_ALLOC(path); CFStringGetFileSystemRepresentation(str, path, PATH_MAX); CFRelease(str); CFRelease(url); } } } return path;}
开发者ID:MSch,项目名称:MacRuby,代码行数:28,
示例14: SQLite3StatementCreateWithBundleResourceinline SQLite3StatementRef SQLite3StatementCreateWithBundleResource(SQLite3ConnectionRef connection, CFBundleRef bundle, CFStringRef type, CFStringRef name, CFStringRef subdir) { SQLite3StatementRef statement = NULL; if (connection) { SInt32 errorCode = 0; CFDictionaryRef properties = NULL; CFDataRef data = NULL; CFURLRef url = CFBundleCopyResourceURL(bundle, name, type, subdir); if (url) { if (CFURLCreateDataAndPropertiesFromResource(connection->allocator, url, &data, &properties, NULL, &errorCode)) { CFStringRef sql = CFStringCreateWithBytes(connection->allocator, CFDataGetBytePtr(data), CFDataGetLength(data), kCFStringEncodingUTF8, 0); if (sql) { statement = SQLite3StatementCreate(connection, sql); CFRelease(sql); } CFRelease(data); if (properties) CFRelease(properties); } else { // TODO: Error } CFRelease(url); } } return statement;}
开发者ID:neostoic,项目名称:CoreSQLite3,代码行数:25,
示例15: GetThePoofImagestatic CGImageRef GetThePoofImage(){ CGDataProviderRef provider; CFStringRef fileName = NULL; CGImageRef image = NULL; CFURLRef url = NULL; CFBundleRef appBundle = CFBundleGetMainBundle(); if ( appBundle == NULL ) goto Bail; fileName = CFStringCreateWithCString( NULL, "ToolbarPoof.png", kCFStringEncodingASCII ); // ToolbarPoof.png is in our Resources directory within the bundle if ( fileName == NULL ) goto Bail; url = CFBundleCopyResourceURL( appBundle, fileName, NULL, NULL ); if ( url == NULL ) goto Bail; provider = CGDataProviderCreateWithURL( url ); image = CGImageCreateWithPNGDataProvider( provider, NULL, false, kCGRenderingIntentDefault ); CGDataProviderRelease( provider );Bail: if ( fileName != NULL ) CFRelease( fileName ); if ( url != NULL ) CFRelease( url ); return( image );}
开发者ID:fruitsamples,项目名称:WindowFun,代码行数:27,
示例16: CFBundleCopyResourceURLvoid SC_StandAloneInfo::SC_StandAloneInfoInit() { char relDir[PATH_MAX]; CFStringEncoding encoding = kCFStringEncodingASCII; if(!haveCheckedBundleStatus) { haveCheckedBundleStatus = true; CFURLRef enablerURL = CFBundleCopyResourceURL ( CFBundleGetMainBundle(), CFSTR("SCClassLibrary"), NULL, NULL ); if ( enablerURL ) { // If sclang or SuperCollider binary is run within the .app bundle, // this is how we find the Resources path. CFStringRef rawPath = CFURLCopyFileSystemPath(enablerURL, kCFURLPOSIXPathStyle); rawPath = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@/.."), rawPath); CFStringGetCString(rawPath, relDir, PATH_MAX, encoding); } else { // when sclang is run from a symlink, the resource URL above will not be found, // so we need to find the path of the executable. uint32_t bufsize = PATH_MAX, *bufsizep = &bufsize; if(_NSGetExecutablePath(relDir, bufsizep)==0) { realpath(relDir, dirPath); // resolve symlink char *dir = dirname(dirPath); strcpy(dirPath, dir); return; } else { // in case it failed, fall back to current directory getcwd(dirPath, PATH_MAX); } } realpath(relDir, dirPath); }}
开发者ID:2mc,项目名称:supercollider,代码行数:34,
|