这篇教程C++ CFURLCreateWithFileSystemPath函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CFURLCreateWithFileSystemPath函数的典型用法代码示例。如果您正苦于以下问题:C++ CFURLCreateWithFileSystemPath函数的具体用法?C++ CFURLCreateWithFileSystemPath怎么用?C++ CFURLCreateWithFileSystemPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CFURLCreateWithFileSystemPath函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: dir_CreatesqInt dir_Create(char *pathString, sqInt pathStringLength) { /* Create a new directory with the given path. By default, this directory is created in the current directory. Use a full path name such as "MyDisk:Working:New Folder" to create folders elsewhere. */ char cFileName[1001]; if (pathStringLength >= 1000) { return false; } /* copy the file name into a null-terminated C string */ sqFilenameFromString((char *) cFileName, (int) pathString, pathStringLength); #if defined(__MWERKS__) { CFStringRef filePath,lastFilePath; CFURLRef sillyThing,sillyThing2; FSRef parentFSRef; UniChar buffer[1024]; long tokenLength; int err; filePath = CFStringCreateWithBytes(kCFAllocatorDefault,(UInt8 *)cFileName,strlen(cFileName),gCurrentVMEncoding,false); if (filePath == nil) return false; sillyThing = CFURLCreateWithFileSystemPath (kCFAllocatorDefault,filePath,kCFURLHFSPathStyle,true); CFRelease(filePath); lastFilePath = CFURLCopyLastPathComponent(sillyThing); tokenLength = CFStringGetLength(lastFilePath); if (tokenLength > 1024) return false; CFStringGetCharacters(lastFilePath,CFRangeMake(0,tokenLength),buffer); CFRelease(lastFilePath); sillyThing2 = CFURLCreateCopyDeletingLastPathComponent(kCFAllocatorDefault,sillyThing); err = CFURLGetFSRef(sillyThing2,&parentFSRef); CFRelease(sillyThing); CFRelease(sillyThing2); if (err == 0) { return false; } err = FSCreateDirectoryUnicode(&parentFSRef,tokenLength,buffer,kFSCatInfoNone,NULL,NULL,NULL,NULL); return (err == noErr ? 1 : 0); }#else return mkdir(cFileName, 0777) == 0;#endif}
开发者ID:estebanlm,项目名称:pharo-vm,代码行数:53,
示例2: path_existsBoolean path_exists(CFTypeRef path) { if (CFGetTypeID(path) == CFStringGetTypeID()) { CFURLRef url = CFURLCreateWithFileSystemPath(NULL, path, kCFURLPOSIXPathStyle, true); Boolean result = CFURLResourceIsReachable(url, NULL); CFRelease(url); return result; } else if (CFGetTypeID(path) == CFURLGetTypeID()) { return CFURLResourceIsReachable(path, NULL); } else { return false; }}
开发者ID:seamountain,项目名称:fruitstrap,代码行数:12,
示例3: urlFromPathstatic bool urlFromPath(CFStringRef path, String& url){ if (!path) return false; RetainPtr<CFURLRef> cfURL(AdoptCF, CFURLCreateWithFileSystemPath(0, path, kCFURLWindowsPathStyle, false)); if (!cfURL) return false; url = String(CFURLGetString(cfURL.get())); return true;}
开发者ID:Chingliu,项目名称:EAWebkit,代码行数:12,
示例4: CFURLCreateWithFileSystemPath//staticQString QFileSystemEngine::bundleName(const QFileSystemEntry &entry){ QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(0, QCFString(entry.filePath()), kCFURLPOSIXPathStyle, true); if (QCFType<CFDictionaryRef> dict = CFBundleCopyInfoDictionaryForURL(url)) { if (CFTypeRef name = (CFTypeRef)CFDictionaryGetValue(dict, kCFBundleNameKey)) { if (CFGetTypeID(name) == CFStringGetTypeID()) return QCFString::toQString((CFStringRef)name); } } return QString();}
开发者ID:BGmot,项目名称:Qt,代码行数:13,
示例5: copyIconDataForPathCFDataRef copyIconDataForPath(CFStringRef path) { CFDataRef data = NULL; //false is probably safest, and is harmless when the object really is a directory. CFURLRef URL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path, kCFURLPOSIXPathStyle, /*isDirectory*/ false); if (URL) { data = copyIconDataForURL(URL); CFRelease(URL); } return data;}
开发者ID:gak,项目名称:iterm,代码行数:12,
示例6: InitwxMetafileRefData::wxMetafileRefData( const wxString& filename ){ Init(); if ( !filename.empty() ) { wxCFRef<CFMutableStringRef> cfMutableString(CFStringCreateMutableCopy(NULL, 0, wxCFStringRef(filename))); CFStringNormalize(cfMutableString,kCFStringNormalizationFormD); wxCFRef<CFURLRef> url(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kCFURLPOSIXPathStyle, false)); m_pdfDoc.reset(CGPDFDocumentCreateWithURL(url)); }}
开发者ID:chromylei,项目名称:third_party,代码行数:12,
示例7: sizeofvoid QStorageInfoPrivate::retrieveUrlProperties(bool initRootPath){ static const void *rootPathKeys[] = { kCFURLVolumeURLKey }; static const void *propertyKeys[] = { // kCFURLVolumeNameKey, // 10.7 // kCFURLVolumeLocalizedNameKey, // 10.7 kCFURLVolumeTotalCapacityKey, kCFURLVolumeAvailableCapacityKey, // kCFURLVolumeIsReadOnlyKey // 10.7 }; size_t size = (initRootPath ? sizeof(rootPathKeys) : sizeof(propertyKeys)) / sizeof(void*); QCFType<CFArrayRef> keys = CFArrayCreate(kCFAllocatorDefault, initRootPath ? rootPathKeys : propertyKeys, size, Q_NULLPTR); if (!keys) return; const QCFString cfPath = rootPath; if (initRootPath) rootPath.clear(); QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfPath, kCFURLPOSIXPathStyle, true); if (!url) return; CFErrorRef error; QCFType<CFDictionaryRef> map = CFURLCopyResourcePropertiesForKeys(url, keys, &error); if (!map) return; if (initRootPath) { const CFURLRef rootUrl = (CFURLRef)CFDictionaryGetValue(map, kCFURLVolumeURLKey); if (!rootUrl) return; rootPath = QCFString(CFURLCopyFileSystemPath(rootUrl, kCFURLPOSIXPathStyle)); valid = true; ready = true; return; } bytesTotal = CFDictionaryGetInt64(map, kCFURLVolumeTotalCapacityKey); bytesAvailable = CFDictionaryGetInt64(map, kCFURLVolumeAvailableCapacityKey); bytesFree = bytesAvailable;}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:52,
示例8: qDebug// staticbool Sandbox::createSecurityToken(const QString& canonicalPath, bool isDirectory) { if (sDebug) { qDebug() << "createSecurityToken" << canonicalPath << isDirectory; } if (!enabled()) { return false; } QMutexLocker locker(&s_mutex); if (s_pSandboxPermissions == NULL) { return false; }#ifdef Q_OS_MAC#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 CFURLRef url = CFURLCreateWithFileSystemPath( kCFAllocatorDefault, QStringToCFString(canonicalPath), kCFURLPOSIXPathStyle, isDirectory); if (url) { CFErrorRef error = NULL; CFDataRef bookmark = CFURLCreateBookmarkData( kCFAllocatorDefault, url, kCFURLBookmarkCreationWithSecurityScope, nil, nil, &error); CFRelease(url); if (bookmark) { QByteArray bookmarkBA = QByteArray( reinterpret_cast<const char*>(CFDataGetBytePtr(bookmark)), CFDataGetLength(bookmark)); QString bookmarkBase64 = QString(bookmarkBA.toBase64()); s_pSandboxPermissions->set(keyForCanonicalPath(canonicalPath), bookmarkBase64); CFRelease(bookmark); return true; } else { if (sDebug) { qDebug() << "Failed to create security-scoped bookmark for" << canonicalPath; if (error != NULL) { qDebug() << "Error:" << CFStringToQString(CFErrorCopyDescription(error)); } } } } else { if (sDebug) { qDebug() << "Failed to create security-scoped bookmark URL for" << canonicalPath; } }#endif#endif return false;}
开发者ID:flashpig,项目名称:mixxx,代码行数:53,
示例9: CFStringCreateWithCStringuint32_t UtilCG::Texture::LoadTexture(const char *const aPath){ CFStringRef Path = CFStringCreateWithCString(kCFAllocatorDefault, aPath, kCFStringEncodingASCII); CFURLRef Url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, Path, kCFURLPOSIXPathStyle, false); CGImageSourceRef Source = CGImageSourceCreateWithURL(Url, NULL); CGImageRef pImage = CGImageSourceCreateImageAtIndex(Source, 0, NULL); if ( !pImage ) { CFRelease(Url); CFRelease(Path); CFRelease(Source); return INVALID_HANDLE; } CGDataProviderRef pDataProvider = CGImageGetDataProvider(pImage); if ( pDataProvider ) { size_t width = CGImageGetWidth(pImage); size_t height = CGImageGetHeight(pImage); //size_t bytesPerRow = CGImageGetBytesPerRow(pImage); //size_t bitsPerPixel = CGImageGetBitsPerPixel(pImage); //size_t bitsPerComponent = CGImageGetBitsPerComponent(pImage); CFDataRef DataRef = CGDataProviderCopyData(pDataProvider); const UInt8* pData = CFDataGetBytePtr(DataRef); uint32_t hTexID = 0; glGenTextures(1, &hTexID); glBindTexture(GL_TEXTURE_2D, hTexID); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLint)width, (GLint)height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pData); glBindTexture(GL_TEXTURE_2D, 0); CFRelease(Url); CFRelease(Path); CFRelease(Source); CGImageRelease(pImage); // CGDataProviderRelease(pDataProvider); return hTexID; } CFRelease(Url); CFRelease(Path); CFRelease(Source); CGImageRelease(pImage); CGDataProviderRelease(pDataProvider); return INVALID_HANDLE;}
开发者ID:leezyli,项目名称:LearnGL,代码行数:52,
示例10: AppleCMIODPSampleNewPlugIn void* AppleCMIODPSampleNewPlugIn(CFAllocatorRef allocator, CFUUIDRef requestedTypeUUID) { if (not CFEqual(requestedTypeUUID, kCMIOHardwarePlugInTypeID)) return 0; try { // Before going any further, make sure the SampleAssistant process is registerred with Mach's bootstrap service. Normally, this would be done by having an appropriately // configured plist in /Library/LaunchDaemons, but if that is done then the process will be owned by root, thus complicating the debugging process. Therefore, in the event that the // plist is missing (as would be the case for most debugging efforts) attempt to register the SampleAssistant now. It will fail gracefully if allready registered. mach_port_t assistantServicePort; name_t assistantServiceName = "com.apple.cmio.DPA.Sample"; kern_return_t err = bootstrap_look_up(bootstrap_port, assistantServiceName, &assistantServicePort); if (BOOTSTRAP_SUCCESS != err) { // Create an URL to SampleAssistant that resides at "/Library/CoreMediaIO/Plug-Ins/DAL/Sample.plugin/Contents/Resources/SampleAssistant" CACFURL assistantURL(CFURLCreateWithFileSystemPath(NULL, CFSTR("/Library/CoreMediaIO/Plug-Ins/DAL/Sample.plugin/Contents/Resources/SampleAssistant"), kCFURLPOSIXPathStyle, false)); ThrowIf(not assistantURL.IsValid(), CAException(-1), "AppleCMIODPSampleNewPlugIn: unable to create URL for the SampleAssistant"); // Get the maximum size of the of the file system representation of the SampleAssistant's absolute path CFIndex length = CFStringGetMaximumSizeOfFileSystemRepresentation(CACFString(CFURLCopyFileSystemPath(CACFURL(CFURLCopyAbsoluteURL(assistantURL.GetCFObject())).GetCFObject(), kCFURLPOSIXPathStyle)).GetCFString()); // Get the file system representation CAAutoFree<char> path(length); (void) CFURLGetFileSystemRepresentation(assistantURL.GetCFObject(), true, reinterpret_cast<UInt8*>(path.get()), length); mach_port_t assistantServerPort; err = bootstrap_create_server(bootstrap_port, path, getuid(), true, &assistantServerPort); ThrowIf(BOOTSTRAP_SUCCESS != err, CAException(err), "AppleCMIODPSampleNewPlugIn: couldn't create server"); err = bootstrap_check_in(assistantServerPort, assistantServiceName, &assistantServicePort); // The server port is no longer needed so get rid of it (void) mach_port_deallocate(mach_task_self(), assistantServerPort); // Make sure the call to bootstrap_create_service() succeeded ThrowIf(BOOTSTRAP_SUCCESS != err, CAException(err), "AppleCMIODPSampleNewPlugIn: couldn't create SampleAssistant service port"); } // The service port is not longer needed so get rid of it (void) mach_port_deallocate(mach_task_self(), assistantServicePort); CMIO::DP::Sample::PlugIn* plugIn = new CMIO::DP::Sample::PlugIn(requestedTypeUUID); plugIn->Retain(); return plugIn->GetInterface(); } catch (...) { return NULL; } }
开发者ID:AdamDiment,项目名称:CocoaSampleCode,代码行数:52,
示例11: Q_Dbool QMacPrintEngine::begin(QPaintDevice *dev){ Q_D(QMacPrintEngine); if (d->state == QPrinter::Idle && d->session == 0) // Need to reinitialize d->initialize(); d->paintEngine->state = state; d->paintEngine->begin(dev); Q_ASSERT_X(d->state == QPrinter::Idle, "QMacPrintEngine", "printer already active"); if (PMSessionValidatePrintSettings(d->session, d->settings, kPMDontWantBoolean) != noErr || PMSessionValidatePageFormat(d->session, d->format, kPMDontWantBoolean) != noErr) { d->state = QPrinter::Error; return false; } if (!d->outputFilename.isEmpty()) { QCFType<CFURLRef> outFile = CFURLCreateWithFileSystemPath(kCFAllocatorSystemDefault, QCFString(d->outputFilename), kCFURLPOSIXPathStyle, false); if (PMSessionSetDestination(d->session, d->settings, kPMDestinationFile, kPMDocumentFormatPDF, outFile) != noErr) { qWarning("QMacPrintEngine::begin: Problem setting file [%s]", d->outputFilename.toUtf8().constData()); return false; } } OSStatus status = noErr;#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) { status = d->shouldSuppressStatus() ? PMSessionBeginCGDocumentNoDialog(d->session, d->settings, d->format) : PMSessionBeginCGDocument(d->session, d->settings, d->format); } else#endif {#ifndef Q_OS_MAC64 status = d->shouldSuppressStatus() ? PMSessionBeginDocumentNoDialog(d->session, d->settings, d->format) : PMSessionBeginDocument(d->session, d->settings, d->format);#endif } if (status != noErr) { d->state = QPrinter::Error; return false; } d->state = QPrinter::Active; setActive(true); d->newPage_helper(); return true;}
开发者ID:FilipBE,项目名称:qtextended,代码行数:51,
示例12: pathbool PluginPackage::load(){ if (m_isLoaded) { m_loadCount++; return true; } WTF::RetainPtr<CFStringRef> path(AdoptCF, m_path.createCFString()); WTF::RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path.get(), kCFURLPOSIXPathStyle, false)); m_module = CFBundleCreate(NULL, url.get()); if (!m_module || !CFBundleLoadExecutable(m_module)) { LOG(Plugins, "%s not loaded", m_path.utf8().data()); return false; } m_isLoaded = true; NP_GetEntryPointsFuncPtr NP_GetEntryPoints = 0; NP_InitializeFuncPtr NP_Initialize; NPError npErr; NP_Initialize = (NP_InitializeFuncPtr)CFBundleGetFunctionPointerForName(m_module, CFSTR("NP_Initialize")); NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)CFBundleGetFunctionPointerForName(m_module, CFSTR("NP_GetEntryPoints")); m_NPP_Shutdown = (NPP_ShutdownProcPtr)CFBundleGetFunctionPointerForName(m_module, CFSTR("NP_Shutdown")); if (!NP_Initialize || !NP_GetEntryPoints || !m_NPP_Shutdown) goto abort; memset(&m_pluginFuncs, 0, sizeof(m_pluginFuncs)); m_pluginFuncs.size = sizeof(m_pluginFuncs); initializeBrowserFuncs(); npErr = NP_Initialize(&m_browserFuncs); LOG_NPERROR(npErr); if (npErr != NPERR_NO_ERROR) goto abort; npErr = NP_GetEntryPoints(&m_pluginFuncs); LOG_NPERROR(npErr); if (npErr != NPERR_NO_ERROR) goto abort; m_loadCount++; return true;abort: unloadWithoutShutdown(); return false;}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:51,
示例13: CreateDirectoryEnumerator//-----------------------------------------------------------------------------CFURLEnumeratorRef CreateDirectoryEnumerator(CFStringRef dirPath){ CFURLRef dirUrl = NULL; CFURLEnumeratorRef dirEnum = NULL; dirUrl = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, dirPath, kCFURLPOSIXPathStyle, true); if (dirUrl ) { dirEnum = CFURLEnumeratorCreateForDirectoryURL(kCFAllocatorDefault, dirUrl, kCFURLEnumeratorDefaultBehavior, NULL); } if (dirUrl) { CFRelease(dirUrl); } return dirEnum;}
开发者ID:notjosh,项目名称:SFBAudioEngine,代码行数:15,
示例14: getPluginBundle/*** Returns a CFBundleRef if the FSSpec refers to a Mac OS X bundle directory.** The caller is responsible for calling CFRelease() to deallocate.*/static CFBundleRef getPluginBundle(const char* path){ CFBundleRef bundle = NULL; CFStringRef pathRef = CFStringCreateWithCString(NULL, path, kCFStringEncodingUTF8); if (pathRef) { CFURLRef bundleURL = CFURLCreateWithFileSystemPath(NULL, pathRef, kCFURLPOSIXPathStyle, true); if (bundleURL != NULL) { bundle = CFBundleCreate(NULL, bundleURL); CFRelease(bundleURL); } CFRelease(pathRef); } return bundle;}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:18,
示例15: copy_device_app_urlCFURLRef copy_device_app_url(AMDeviceRef device, CFStringRef identifier) { CFDictionaryRef result; assert(AMDeviceLookupApplications(device, 0, &result) == 0); CFDictionaryRef app_dict = CFDictionaryGetValue(result, identifier); assert(app_dict != NULL); CFStringRef app_path = CFDictionaryGetValue(app_dict, CFSTR("Path")); assert(app_path != NULL); CFURLRef url = CFURLCreateWithFileSystemPath(NULL, app_path, kCFURLPOSIXPathStyle, true); CFRelease(result); return url;}
开发者ID:MaksimKovalyov,项目名称:fruitstrap,代码行数:14,
示例16: ASSERTvoid Download::didDecideDestination(const String& destination, bool allowOverwrite){ ASSERT(!destination.isEmpty()); if (destination.isEmpty()) return; m_allowOverwrite = allowOverwrite; m_destination = destination; m_bundlePath = destination + DownloadBundle::fileExtension(); RetainPtr<CFStringRef> bundlePath(AdoptCF, CFStringCreateWithCharactersNoCopy(0, reinterpret_cast<const UniChar*>(m_bundlePath.characters()), m_bundlePath.length(), kCFAllocatorNull)); RetainPtr<CFURLRef> bundlePathURL(AdoptCF, CFURLCreateWithFileSystemPath(0, bundlePath.get(), kCFURLWindowsPathStyle, false)); CFURLDownloadSetDestination(m_download.get(), bundlePathURL.get(), allowOverwrite);}
开发者ID:jiezh,项目名称:h5vcc,代码行数:14,
示例17: PsychInitializePsychHID/* PsychInitializePsychHID() * * Master init routine - Called at module load time / first time init. * */void PsychInitializePsychHID(void){ int i; // Initialize the generic USB tracker to "all off" state: for (i = 0; i < PSYCH_HID_MAX_GENERIC_USB_DEVICES; i++) { usbDeviceRecordBank[i].valid = 0; } // Setup event ringbuffers: for (i = 0; i < PSYCH_HID_MAX_DEVICES; i++) { hidEventBuffer[i] = NULL; hidEventBufferCapacity[i] = 10000; // Initial capacity of event buffer. hidEventBufferReadPos[i] = 0; hidEventBufferWritePos[i] = 0; }#if PSYCH_SYSTEM == PSYCH_OSX for (i = 0; i < MAXDEVICEINDEXS; i++) deviceInterfaces[i] = NULL; // Try to load all bundles from Psychtoolbox/PsychHardware/ // This loads the HID_Utilities.framework bundle if it is present. The whole point of it is // to allow our statically compiled-in version of the library to find the location of // the XML file with the database of (vendorId, productId) -> (VendorName, ProductName) and // (usagePage, usage) -> (usageName) mappings. // // In practice, the XML file only serves as a fallback, and one that doesn't contain much // useful info for mainstream products, only for a few niche products. Given its limited // value, i think we can refrain from shipping the framework as part of Psychtoolbox and // just provide the option to use it (== its XML file) if users decide to install it themselves. char tmpString[1024]; sprintf(tmpString, "%sPsychHardware/", PsychRuntimeGetPsychtoolboxRoot(FALSE)); CFStringRef urlString = CFStringCreateWithCString(kCFAllocatorDefault, tmpString, kCFStringEncodingASCII); CFURLRef directoryURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, urlString, kCFURLPOSIXPathStyle, false); CFRelease(urlString); CFArrayRef bundleArray = CFBundleCreateBundlesFromDirectory(kCFAllocatorDefault, directoryURL, NULL); CFRelease(directoryURL); CFRelease(bundleArray);#endif // Initialize OS specific interfaces and routines: PsychHIDInitializeHIDStandardInterfaces(); // This sets up data structures for HID report reception inside PsychHIDReceiveReports.c: PsychHIDReleaseAllReportMemory(); return;}
开发者ID:zacklb,项目名称:Psychtoolbox-3,代码行数:55,
示例18: fFragmentPOSCodeFragment::OSCodeFragment(const char* inPath): fFragmentP(NULL){#if defined(HPUX) || defined(HPUX10) shl_t handle; fFragmentP = shl_load(inPath, BIND_IMMEDIATE|BIND_VERBOSE|BIND_NOSTART, 0L);#elif defined(OSF1) ||/ (defined(__FreeBSD_version) && (__FreeBSD_version >= 220000)) fFragmentP = dlopen((char *)inPath, RTLD_NOW | RTLD_GLOBAL);#elif defined(__FreeBSD__) fFragmentP = dlopen(inPath, RTLD_NOW);#elif defined(__sgi__) fFragmentP = dlopen(inPath, RTLD_NOW); // not sure this should be either RTLD_NOW or RTLD_LAZY#elif defined(__Win32__) fFragmentP = ::LoadLibrary(inPath);#elif defined(__MacOSX__) CFStringRef theString = CFStringCreateWithCString( kCFAllocatorDefault, inPath, kCFStringEncodingASCII); // // In MacOSX, our "fragments" are CF bundles, which are really // directories, so our paths are paths to a directory CFURLRef bundleURL = CFURLCreateWithFileSystemPath( kCFAllocatorDefault, theString, kCFURLPOSIXPathStyle, true); // // I figure CF is safe about having NULL passed // into its functions (if fBundle failed to get created). // So, I won't worry about error checking myself fFragmentP = CFBundleCreate( kCFAllocatorDefault, bundleURL ); Boolean success = false; if (fFragmentP != NULL) success = CFBundleLoadExecutable( fFragmentP ); if (!success && fFragmentP != NULL) { CFRelease( fFragmentP ); fFragmentP = NULL; } CFRelease(bundleURL); CFRelease(theString); #else fFragmentP = dlopen(inPath, RTLD_NOW | RTLD_GLOBAL); //fprintf (stderr, "%s/n", dlerror());#endif}
开发者ID:12307,项目名称:EasyDarwin,代码行数:49,
示例19: InitBMDSwitcherAPI_v4_0static void InitBMDSwitcherAPI_v4_0 (void){ CFURLRef bundleURL; bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR(kBMDSwitcherAPI_BundlePath), kCFURLPOSIXPathStyle, true); if (bundleURL != NULL) { gBundleRef = CFBundleCreate(kCFAllocatorDefault, bundleURL); if (gBundleRef != NULL) { gCreateDiscoveryFunc = (CreateDiscoveryFunc)CFBundleGetFunctionPointerForName(gBundleRef, CFSTR("GetBMDSwitcherDiscoveryInstance_0000")); } CFRelease(bundleURL); }}
开发者ID:wilsonlmh,项目名称:atemHTMLTally,代码行数:15,
示例20: StoreDictionaryInPlistvoid StoreDictionaryInPlist(CFPropertyListRef propListRef, CFStringRef stringPlist, SInt32 *errorCode){ CFErrorRef errorRef; CFURLRef fileURLRef = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,stringPlist,kCFURLPOSIXPathStyle,false); CFDataRef dataRef = CFPropertyListCreateData(kCFAllocatorDefault, propListRef, kCFPropertyListXMLFormat_v1_0, 0, &errorRef); // Write the plist to the file. Boolean status = CFURLWriteDataAndPropertiesToResource(fileURLRef, dataRef, NULL, errorCode); if (!status) { //error } CFRelease(fileURLRef); CFRelease(dataRef);}
开发者ID:Frederikus,项目名称:eid-mw,代码行数:15,
示例21: copyIconDataCFDataRef copyIconData(CFStringRef path){ CFDataRef data = NULL; CFURLRef URL = CFURLCreateWithFileSystemPath( kCFAllocatorDefault, path, // file path name kCFURLPOSIXPathStyle, // interpret as POSIX path false ); // is it a directory? if (URL) { FSRef ref; if (CFURLGetFSRef(URL, &ref)) { IconRef icon = NULL; SInt16 label_noOneCares; OSStatus err = GetIconRefFromFileInfo(&ref, /*inFileNameLength*/ 0U, /*inFileName*/ NULL, kFSCatInfoNone, /*inCatalogInfo*/ NULL, kIconServicesNoBadgeFlag | kIconServicesUpdateIfNeededFlag, &icon, &label_noOneCares); if (err != noErr) { printf("Could not get icon/n"); } else { IconFamilyHandle fam = NULL; // err = IconRefToIconFamily(icon, kSelectorAllAvailableData, &fam); err = ReadIconFromFSRef(&ref, &fam); if (err != noErr) { printf("Could not get icon/n"); } else { HLock((Handle)fam); data = CFDataCreate(kCFAllocatorDefault, (const UInt8 *)*(Handle)fam, GetHandleSize((Handle)fam)); HUnlock((Handle)fam); DisposeHandle((Handle)fam); } ReleaseIconRef(icon); } } } CFSafeRelease(URL); return data; }
开发者ID:fishman,项目名称:growlirssi,代码行数:48,
示例22: create_trusted_app_from_bundle_resourceSTATIC SecTrustedApplicationRefcreate_trusted_app_from_bundle_resource(CFStringRef bundle_path, CFStringRef resource_path){ CFBundleRef bundle; CFURLRef bundle_url; CFURLRef eapolclient_url = NULL; char path[MAXPATHLEN]; Boolean success = FALSE; SecTrustedApplicationRef trusted_app = NULL; bundle_url = CFURLCreateWithFileSystemPath(NULL, bundle_path, kCFURLPOSIXPathStyle, FALSE); if (bundle_url == NULL) { goto done; } bundle = CFBundleCreate(NULL, bundle_url); CFRelease(bundle_url); if (bundle == NULL) { goto done; } eapolclient_url = CFBundleCopyResourceURL(bundle, CFSTR(keapolclientPath), NULL, NULL); CFRelease(bundle); if (eapolclient_url == NULL) { goto done; } success = CFURLGetFileSystemRepresentation(eapolclient_url, TRUE, (UInt8 *)path, sizeof(path)); CFRelease(eapolclient_url); if (success) { OSStatus status; status = SecTrustedApplicationCreateFromPath(path, &trusted_app); if (status != noErr) { fprintf(stderr, "SecTrustedApplicationCreateFromPath(%s) failed, %d/n", path, (int)status); } } done: return (trusted_app);}
开发者ID:gfleury,项目名称:eap8021x-debug,代码行数:48,
示例23: _CFCopyLocalizedVersionKeystatic CFStringRef _CFCopyLocalizedVersionKey(CFBundleRef *bundlePtr, CFStringRef nonLocalized) { CFStringRef localized = NULL; CFBundleRef locBundle = bundlePtr ? *bundlePtr : NULL; if (!locBundle) { CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorSystemDefault, CFSTR("/System/Library/CoreServices/SystemVersion.bundle"), kCFURLPOSIXPathStyle, false); if (url) { locBundle = CFBundleCreate(kCFAllocatorSystemDefault, url); CFRelease(url); } } if (locBundle) { localized = CFBundleCopyLocalizedString(locBundle, nonLocalized, nonLocalized, CFSTR("SystemVersion")); if (bundlePtr) *bundlePtr = locBundle; else CFRelease(locBundle); } return localized ? localized : (CFStringRef)CFRetain(nonLocalized);}
开发者ID:macmade,项目名称:CoreFoundation-550.42,代码行数:16,
示例24: CreateDictionaryFromPlistCFDictionaryRef CreateDictionaryFromPlist(CFStringRef stringPlist, SInt32 *errorCode){ CFDataRef dataRef; CFStringRef errorStringRef; CFURLRef fileURLRef = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,stringPlist,kCFURLPOSIXPathStyle,false); Boolean status = CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault,fileURLRef,&dataRef,NULL,NULL,errorCode); if (!status) { //error } CFDictionaryRef dictRef = CFPropertyListCreateFromXMLData(kCFAllocatorDefault,dataRef, kCFPropertyListMutableContainersAndLeaves,&errorStringRef); CFRelease(fileURLRef); CFRelease(dataRef); return dictRef;}
开发者ID:Frederikus,项目名称:eid-mw,代码行数:16,
示例25: _preferencesDirectoryForUserHostSafetyLevelstatic CFURLRef _preferencesDirectoryForUserHostSafetyLevel(CFStringRef userName, CFStringRef hostName, unsigned long safeLevel) { CFAllocatorRef alloc = __CFPreferencesAllocator();#if TARGET_OS_WIN32 CFURLRef url = NULL; CFMutableStringRef completePath = _CFCreateApplicationRepositoryPath(alloc, CSIDL_APPDATA); if (completePath) { // append "Preferences/" and make the CFURL CFStringAppend(completePath, CFSTR("Preferences//")); url = CFURLCreateWithFileSystemPath(alloc, completePath, kCFURLWindowsPathStyle, true); CFRelease(completePath); } // Can't find a better place? Home directory then? if (url == NULL) url = CFCopyHomeDirectoryURLForUser((userName == kCFPreferencesCurrentUser) ? NULL : userName); return url; #else CFURLRef location = NULL; CFKnownLocationUser user; if (userName == kCFPreferencesAnyUser) { user = _kCFKnownLocationUserAny; } else if (userName == kCFPreferencesCurrentUser) { user = _kCFKnownLocationUserCurrent; } else { user = _kCFKnownLocationUserByName; } CFURLRef base = _CFKnownLocationCreatePreferencesURLForUser(user, userName); if (hostName == kCFPreferencesCurrentHost) { location = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("ByHost"), kCFURLPOSIXPathStyle, true, base); } else { assert(hostName == kCFPreferencesAnyHost); location = CFRetain(base); } CFRelease(base); return location;#endif}
开发者ID:JGiola,项目名称:swift-corelibs-foundation,代码行数:47,
示例26: urlFromPathstatic bool urlFromPath(CFStringRef path, String& url){ if (!path) return false; RetainPtr<CFURLRef> cfURL(AdoptCF, CFURLCreateWithFileSystemPath(0, path, kCFURLWindowsPathStyle, false)); if (!cfURL) return false; url = CFURLGetString(cfURL.get()); // Work around <rdar://problem/6708300>, where CFURLCreateWithFileSystemPath makes URLs with "localhost". if (url.startsWith("file://localhost/")) url.remove(7, 9); return true;}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:17,
示例27: InitBMDStreamingAPIvoid InitBMDStreamingAPI(void){ CFURLRef bundleURL; bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR(kBMDStreamingAPI_BundlePath), kCFURLPOSIXPathStyle, true); if (bundleURL != NULL) { gBMDStreamingAPIBundleRef = CFBundleCreate(kCFAllocatorDefault, bundleURL); if (gBMDStreamingAPIBundleRef != NULL) { gCreateDiscoveryFunc = (CreateDiscoveryFunc)CFBundleGetFunctionPointerForName(gBMDStreamingAPIBundleRef, CFSTR("CreateBMDStreamingDiscoveryInstance_0002")); gCreateNALParserFunc = (CreateNALParserFunc)CFBundleGetFunctionPointerForName(gBMDStreamingAPIBundleRef, CFSTR("CreateBMDStreamingH264NALParser_0001")); } CFRelease(bundleURL); }}
开发者ID:Dead133,项目名称:obs-studio,代码行数:17,
注:本文中的CFURLCreateWithFileSystemPath函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CFURLCreateWithString函数代码示例 C++ CFURLCreateFromFileSystemRepresentation函数代码示例 |