这篇教程C++ CFBundleCopyExecutableURL函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CFBundleCopyExecutableURL函数的典型用法代码示例。如果您正苦于以下问题:C++ CFBundleCopyExecutableURL函数的具体用法?C++ CFBundleCopyExecutableURL怎么用?C++ CFBundleCopyExecutableURL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CFBundleCopyExecutableURL函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: open_bundlestatic FILE *open_bundle(const char * path, const char * mode){ char full_path[1024] = {}; CFStringRef path_cfstring = NULL; CFURLRef path_url = NULL; CFBundleRef bundle = NULL; CFURLRef exec = NULL; path_cfstring = CFStringCreateWithFileSystemRepresentation(kCFAllocatorDefault, path); require_quiet(path_cfstring, out); path_url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path_cfstring, kCFURLPOSIXPathStyle, true); require_quiet(path_url, out); bundle = CFBundleCreate(kCFAllocatorDefault, path_url); require_quiet(bundle, out); exec = CFBundleCopyExecutableURL(bundle); require(exec, out); require(CFURLGetFileSystemRepresentation(exec, true, (uint8_t*)full_path, sizeof(full_path)), out);out: CFReleaseSafe(path_cfstring); CFReleaseSafe(path_url); CFReleaseSafe(bundle); CFReleaseSafe(exec); return fopen(full_path, "r");}
开发者ID:unofficial-opensource-apple,项目名称:Security,代码行数:26,
示例2: CFBundleGetMainBundle Paths::Paths() { std::string workingDirectory { "." /* boost::filesystem::current_path().string() */ }; std::string logDirectory { workingDirectory + "/log" }; std::string resourcesDirectory { workingDirectory + "/resources" }; // If in MacOS, we get these in a somewhat different manner, because Apple has to be different. // (See https://stackoverflow.com/questions/516200/relative-paths-not-working-in-xcode-c?rq=1 for details) #ifdef __APPLE__ CFBundleRef mainBundle = CFBundleGetMainBundle(); char path[PATH_MAX]; CFURLRef executableURL = CFBundleCopyExecutableURL(mainBundle); if (!CFURLGetFileSystemRepresentation(executableURL, TRUE, (UInt8 *)path, PATH_MAX)) { LOG(FATAL) << "Could not obtain resources directory name from CoreFoundation!"; } logDirectory = std::string(path) + "/log"; CFRelease(executableURL); CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX)) { LOG(FATAL) << "Could not obtain resources directory name from CoreFoundation!"; } resourcesDirectory = std::string(path); CFRelease(resourcesURL); #endif std::cout << "Log directory is " << logDirectory << std::endl; std::cout << "Resources directory is " << resourcesDirectory << std::endl; m_logsPath = logDirectory; m_resourcesPath = resourcesDirectory; }
开发者ID:glindsey,项目名称:MetaHack,代码行数:35,
示例3: _CFBundleDlfcnCheckLoadedCF_PRIVATE Boolean _CFBundleDlfcnCheckLoaded(CFBundleRef bundle) { if (!bundle->_isLoaded) { CFURLRef executableURL = CFBundleCopyExecutableURL(bundle); char buff[CFMaxPathSize]; if (executableURL && CFURLGetFileSystemRepresentation(executableURL, true, (uint8_t *)buff, CFMaxPathSize)) { int mode = RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD | RTLD_FIRST; void *handle = dlopen(buff, mode); if (handle) { if (!bundle->_handleCookie) { bundle->_handleCookie = handle;#if LOG_BUNDLE_LOAD printf("dlfcn check load bundle %p, dlopen of %s mode 0x%x getting handle %p/n", bundle, buff, mode, bundle->_handleCookie);#endif /* LOG_BUNDLE_LOAD */ } bundle->_isLoaded = true; } else {#if LOG_BUNDLE_LOAD printf("dlfcn check load bundle %p, dlopen of %s mode 0x%x no handle/n", bundle, buff, mode);#endif /* LOG_BUNDLE_LOAD */ } } if (executableURL) CFRelease(executableURL); } return bundle->_isLoaded;}
开发者ID:parkera,项目名称:swift-corelibs-foundation,代码行数:26,
示例4: cfStringReleasestring Bundle::executablePath() const{ if (mExecutablePath.empty()) return mExecutablePath = cfStringRelease(CFBundleCopyExecutableURL(cfBundle())); else return mExecutablePath;}
开发者ID:Proteas,项目名称:codesign,代码行数:7,
示例5: _CFBundleDYLDCheckLoadedCF_PRIVATE Boolean _CFBundleDYLDCheckLoaded(CFBundleRef bundle) { if (!bundle->_isLoaded) { CFURLRef executableURL = CFBundleCopyExecutableURL(bundle); char buff[CFMaxPathSize]; if (executableURL && CFURLGetFileSystemRepresentation(executableURL, true, (uint8_t *)buff, CFMaxPathSize)) { const void *header = __CFBundleDYLDFindImage(buff); if (header) { if (bundle->_binaryType == __CFBundleUnknownBinary) bundle->_binaryType = __CFBundleDYLDFrameworkBinary; if (!bundle->_imageCookie) { bundle->_imageCookie = header;#if LOG_BUNDLE_LOAD printf("dyld check load bundle %p, find %s getting image %p/n", bundle, buff, bundle->_imageCookie);#endif /* LOG_BUNDLE_LOAD */ } bundle->_isLoaded = true; } else {#if LOG_BUNDLE_LOAD printf("dyld check load bundle %p, find %s no image/n", bundle, buff);#endif /* LOG_BUNDLE_LOAD */ } } if (executableURL) CFRelease(executableURL); } return bundle->_isLoaded;}
开发者ID:parkera,项目名称:swift-corelibs-foundation,代码行数:26,
示例6: examine_bundle/* Examines a directory, treating it as a bundle, and determines whether it has an executable.* Examines the executable as a regular file to determine which architectures it matches.* Prints out the results.*/static void examine_bundle(const uint8_t *bundle_path) { CFURLRef bundleURL = CFURLCreateFromFileSystemRepresentation(NULL, bundle_path, strlen((const char *)bundle_path), true), executableURL = NULL; CFBundleRef bundle = NULL; uint8_t path[PATH_MAX]; struct stat statBuf; if (bundleURL && (bundle = CFBundleCreate(NULL, bundleURL))) { // Try to obtain a path to an executable within the bundle. executableURL = CFBundleCopyExecutableURL(bundle); if (executableURL && CFURLGetFileSystemRepresentation(executableURL, true, path, PATH_MAX) && stat((const char *)path, &statBuf) == 0) { // Make sure it is a regular file, and if so examine it as a regular file. if ((statBuf.st_mode & S_IFMT) == S_IFREG) { examine_file(path); } else { printf("Unsupported file type for file %s./n", path); } } else { printf("No executable located for %s./n", bundle_path); } } else { printf("Cannot read %s./n", bundle_path); } if (executableURL) CFRelease(executableURL); if (bundle) CFRelease(bundle); if (bundleURL) CFRelease(bundleURL);}
开发者ID:ZeusFramework,项目名称:ZeusbaseUIKit,代码行数:29,
示例7: gettimeofdaybool Shell::Initialise(const Rocket::Core::String& path){ gettimeofday(&start_time, NULL); InputMacOSX::Initialise(); // Find the location of the executable. CFBundleRef bundle = CFBundleGetMainBundle(); CFURLRef executable_url = CFBundleCopyExecutableURL(bundle); CFStringRef executable_posix_file_name = CFURLCopyFileSystemPath(executable_url, kCFURLPOSIXPathStyle); CFIndex max_length = CFStringGetMaximumSizeOfFileSystemRepresentation(executable_posix_file_name); char* executable_file_name = new char[max_length]; if (!CFStringGetFileSystemRepresentation(executable_posix_file_name, executable_file_name, max_length)) executable_file_name[0] = 0; executable_path = Rocket::Core::String(executable_file_name); executable_path = executable_path.Substring(0, executable_path.RFind("/") + 1); delete[] executable_file_name; CFRelease(executable_posix_file_name); CFRelease(executable_url); file_interface = new ShellFileInterface(executable_path + "../../../" + path); Rocket::Core::SetFileInterface(file_interface); return true;}
开发者ID:czbming,项目名称:libRocket,代码行数:27,
示例8: getExePathbool getExePath(char *respath){ CFBundleRef appBundle = CFBundleGetMainBundle(); if (!appBundle) return false; CFURLRef url = CFBundleCopyExecutableURL(appBundle); if (!url) return false; CFURLRef absurl = nullptr; // CFURLRef url2 = url; CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(NULL, url); CFRelease(url); absurl = CFURLCopyAbsoluteURL(url2); CFRelease(url2); char tbuffer[MAXPATHLEN]; CFURLGetFileSystemRepresentation(absurl, true, (UInt8*) tbuffer, sizeof(tbuffer)); printf("abs exec url = %s/n", tbuffer); CFRelease(absurl); snprintf(respath, MAXPATHLEN, "%s/XUL", tbuffer); return true;}
开发者ID:CueMol,项目名称:cuemol2,代码行数:28,
示例9: _CFBundleDLLLoadCF_PRIVATE Boolean _CFBundleDLLLoad(CFBundleRef bundle, CFErrorRef *error) { CFErrorRef localError = NULL; if (!bundle->_isLoaded) { CFURLRef executableURL = CFBundleCopyExecutableURL(bundle); wchar_t buff[CFMaxPathSize]; if (executableURL && _CFURLGetWideFileSystemRepresentation(executableURL, true, (wchar_t *)buff, CFMaxPathSize)) { bundle->_hModule = LoadLibraryW(buff); if (bundle->_hModule) { bundle->_isLoaded = true; } else { if (error) { localError = _CFBundleCreateError(CFGetAllocator(bundle), bundle, CFBundleExecutableLinkError); } else { CFLog(__kCFLogBundle, CFSTR("Failed to load bundle %@"), bundle); } } } else { if (error) { localError = _CFBundleCreateError(CFGetAllocator(bundle), bundle, CFBundleExecutableNotFoundError); } else { CFLog(__kCFLogBundle, CFSTR("Cannot find executable for bundle %@"), bundle); } } if (executableURL) CFRelease(executableURL); } if (!bundle->_isLoaded && error) *error = localError; return bundle->_isLoaded;}
开发者ID:parkera,项目名称:swift-corelibs-foundation,代码行数:29,
示例10: GetXULRunnerStubPath// This is a copy of OS X's XRE_GetBinaryPath from nsAppRunner.cpp with the// gBinaryPath check removed so that the updater can reload the stub executable// instead of xulrunner-bin. See bug 349737.static nsresultGetXULRunnerStubPath(const char* argv0, nsILocalFile* *aResult){ nsresult rv; nsCOMPtr<nsILocalFile> lf; NS_NewNativeLocalFile(EmptyCString(), PR_TRUE, getter_AddRefs(lf)); nsCOMPtr<nsILocalFileMac> lfm (do_QueryInterface(lf)); if (!lfm) return NS_ERROR_FAILURE; // Works even if we're not bundled. CFBundleRef appBundle = CFBundleGetMainBundle(); if (!appBundle) return NS_ERROR_FAILURE; CFURLRef bundleURL = CFBundleCopyExecutableURL(appBundle); if (!bundleURL) return NS_ERROR_FAILURE; FSRef fileRef; if (!CFURLGetFSRef(bundleURL, &fileRef)) { CFRelease(bundleURL); return NS_ERROR_FAILURE; } rv = lfm->InitWithFSRef(&fileRef); CFRelease(bundleURL); if (NS_FAILED(rv)) return rv; NS_ADDREF(*aResult = lf); return NS_OK;}
开发者ID:lofter2011,项目名称:Icefox,代码行数:38,
示例11: CFBundleGetMainBundlevoid BlackBoxApp::loadImage() {#ifdef TARGET_OSX // Get the absolute location of the executable file in the bundle. CFBundleRef appBundle = CFBundleGetMainBundle(); CFURLRef executableURL = CFBundleCopyExecutableURL(appBundle); char execFile[4096]; if (CFURLGetFileSystemRepresentation(executableURL, TRUE, (UInt8 *)execFile, 4096)) { // Strip out the filename to just get the path string strExecFile = execFile; int found = strExecFile.find_last_of("/"); string strPath = strExecFile.substr(0, found); // Change the working directory to that of the executable if(-1 == chdir(strPath.c_str())) { ofLog(OF_LOG_ERROR, "Unable to change working directory to executable's directory."); } } else { ofLog(OF_LOG_ERROR, "Unable to identify executable's directory."); } CFRelease(executableURL);#endif image.loadImage("image.png"); image.setAnchorPercent(0.5, 0.5);}
开发者ID:grifotv,项目名称:blackbox,代码行数:25,
示例12: getCFURLRefCFCBundle::CopyExecutableURL () const{ CFBundleRef bundle = get(); if (bundle != NULL) return CFBundleCopyExecutableURL(bundle); return NULL;}
开发者ID:32bitmicro,项目名称:riscv-lldb,代码行数:8,
示例13: adoptCFvoid TestController::initializeTestPluginDirectory(){ RetainPtr<CFURLRef> bundleURL = adoptCF(CFBundleCopyExecutableURL(CFBundleGetMainBundle())); RetainPtr<CFURLRef> bundleDirectoryURL = adoptCF(CFURLCreateCopyDeletingLastPathComponent(0, bundleURL.get())); RetainPtr<CFStringRef> testPluginDirectoryNameString = adoptCF(CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(testPluginDirectoryName), wcslen(testPluginDirectoryName))); RetainPtr<CFURLRef> testPluginDirectoryURL = adoptCF(CFURLCreateCopyAppendingPathComponent(0, bundleDirectoryURL.get(), testPluginDirectoryNameString.get(), true)); RetainPtr<CFStringRef> testPluginDirectoryPath = adoptCF(CFURLCopyFileSystemPath(testPluginDirectoryURL.get(), kCFURLWindowsPathStyle)); m_testPluginDirectory.adopt(WKStringCreateWithCFString(testPluginDirectoryPath.get()));}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:9,
示例14: _CFBundleDlfcnPreflightCF_EXPORT Boolean _CFBundleDlfcnPreflight(CFBundleRef bundle, CFErrorRef *error) { Boolean retval = true; CFErrorRef localError = NULL; if (!bundle->_isLoaded) { CFURLRef executableURL = CFBundleCopyExecutableURL(bundle); char buff[CFMaxPathSize]; retval = false; if (executableURL && CFURLGetFileSystemRepresentation(executableURL, true, (uint8_t *)buff, CFMaxPathSize)) {#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED retval = dlopen_preflight(buff);#endif if (!retval && error) { CFArrayRef archs = CFBundleCopyExecutableArchitectures(bundle); CFStringRef debugString = NULL; const char *errorString = dlerror(); if (errorString && strlen(errorString) > 0) debugString = CFStringCreateWithFileSystemRepresentation(kCFAllocatorSystemDefault, errorString); if (archs) { Boolean hasSuitableArch = false, hasRuntimeMismatch = false; CFIndex i, count = CFArrayGetCount(archs); SInt32 arch, curArch = _CFBundleCurrentArchitecture(); for (i = 0; !hasSuitableArch && i < count; i++) { if (CFNumberGetValue((CFNumberRef)CFArrayGetValueAtIndex(archs, i), kCFNumberSInt32Type, (void *)&arch) && arch == curArch) hasSuitableArch = true; }#if defined(BINARY_SUPPORT_DYLD) if (hasSuitableArch) { uint32_t mainFlags = 0; if (_CFBundleGrokObjCImageInfoFromMainExecutable(NULL, &mainFlags) && (mainFlags & 0x2) != 0) {#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED uint32_t bundleFlags = 0; if (_CFBundleGetObjCImageInfo(bundle, NULL, &bundleFlags) && (bundleFlags & 0x2) == 0) hasRuntimeMismatch = true;#endif } }#endif /* BINARY_SUPPORT_DYLD */ if (hasRuntimeMismatch) { localError = _CFBundleCreateErrorDebug(CFGetAllocator(bundle), bundle, CFBundleExecutableRuntimeMismatchError, debugString); } else if (!hasSuitableArch) { localError = _CFBundleCreateErrorDebug(CFGetAllocator(bundle), bundle, CFBundleExecutableArchitectureMismatchError, debugString); } else { localError = _CFBundleCreateErrorDebug(CFGetAllocator(bundle), bundle, CFBundleExecutableLoadError, debugString); } CFRelease(archs); } else { localError = _CFBundleCreateErrorDebug(CFGetAllocator(bundle), bundle, CFBundleExecutableLoadError, debugString); } if (debugString) CFRelease(debugString); } } else { if (error) localError = _CFBundleCreateError(CFGetAllocator(bundle), bundle, CFBundleExecutableNotFoundError); } if (executableURL) CFRelease(executableURL); } if (!retval && error) *error = localError; return retval;}
开发者ID:parkera,项目名称:swift-corelibs-foundation,代码行数:56,
示例15: NS_WARNINGPRBool nsPluginsDir::IsPluginFile(nsIFile* file){ nsCString temp; file->GetNativeLeafName(temp); /* * Don't load the VDP fake plugin, to avoid tripping a bad bug in OS X * 10.5.3 (see bug 436575). */ if (!strcmp(temp.get(), "VerifiedDownloadPlugin.plugin")) { NS_WARNING("Preventing load of VerifiedDownloadPlugin.plugin (see bug 436575)"); return PR_FALSE; } // If we're running on OS X Lion (10.7) or later, don't load the Java Embedding // Plugin (any version). If/when Steven Michaud releases a version of the JEP that // works on Lion, we'll need to revise this code. See bug 670655. if (OnLionOrLater() && !strcmp(temp.get(), "MRJPlugin.plugin")) { NS_WARNING("Preventing load of Java Embedding Plugin (MRJPlugin.plugin) on OS X Lion (see bug 670655)"); return PR_FALSE; } CFURLRef pluginURL = NULL; if (NS_FAILED(toCFURLRef(file, pluginURL))) return PR_FALSE; PRBool isPluginFile = PR_FALSE; CFBundleRef pluginBundle = CFBundleCreate(kCFAllocatorDefault, pluginURL); if (pluginBundle) { UInt32 packageType, packageCreator; CFBundleGetPackageInfo(pluginBundle, &packageType, &packageCreator); if (packageType == 'BRPL' || packageType == 'IEPL' || packageType == 'NSPL') { CFURLRef executableURL = CFBundleCopyExecutableURL(pluginBundle); if (executableURL) { isPluginFile = IsLoadablePlugin(executableURL); ::CFRelease(executableURL); } } ::CFRelease(pluginBundle); } else { LSItemInfoRecord info; if (LSCopyItemInfoForURL(pluginURL, kLSRequestTypeCreator, &info) == noErr) { if ((info.filetype == 'shlb' && info.creator == 'MOSS') || info.filetype == 'NSPL' || info.filetype == 'BRPL' || info.filetype == 'IEPL') { isPluginFile = IsLoadablePlugin(pluginURL); } } } ::CFRelease(pluginURL); return isPluginFile;}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:54,
示例16: _CFBundleDYLDLoadFrameworkCF_PRIVATE Boolean _CFBundleDYLDLoadFramework(CFBundleRef bundle, CFErrorRef *error) { // !!! Framework loading should be better. Can't unload frameworks. CFErrorRef localError = NULL, *subError = (error ? &localError : NULL); NSLinkEditErrors c = NSLinkEditUndefinedError; int errorNumber = 0; const char *fileName = NULL; const char *errorString = NULL; if (!bundle->_isLoaded) { CFURLRef executableURL = CFBundleCopyExecutableURL(bundle); char buff[CFMaxPathSize]; if (executableURL && CFURLGetFileSystemRepresentation(executableURL, true, (uint8_t *)buff, CFMaxPathSize)) { void *image = (void *)NSAddImage(buff, NSADDIMAGE_OPTION_RETURN_ON_ERROR);#if LOG_BUNDLE_LOAD printf("dyld load framework %p, add image of %s returns image %p/n", bundle, buff, image);#endif /* LOG_BUNDLE_LOAD */ if (image) { bundle->_imageCookie = image; bundle->_isLoaded = true; } else { NSLinkEditError(&c, &errorNumber, &fileName, &errorString); if (error) {#if defined(BINARY_SUPPORT_DLFCN) _CFBundleDlfcnPreflight(bundle, subError);#endif /* BINARY_SUPPORT_DLFCN */ if (!localError) { CFStringRef tempString = CFStringCreateWithFileSystemRepresentation(kCFAllocatorSystemDefault, errorString), debugString = CFStringCreateWithFormat(kCFAllocatorSystemDefault, NULL, CFSTR("error code %d, error number %d (%@)"), c, errorNumber, tempString); localError = _CFBundleCreateErrorDebug(CFGetAllocator(bundle), bundle, CFBundleExecutableLinkError, debugString); if (tempString) CFRelease(tempString); if (debugString) CFRelease(debugString); } } else { CFStringRef tempString = CFStringCreateWithFileSystemRepresentation(kCFAllocatorSystemDefault, errorString), executableString = CFStringCreateWithFileSystemRepresentation(kCFAllocatorSystemDefault, fileName); CFLog(__kCFLogBundle, CFSTR("Error loading %@: error code %d, error number %d (%@)"), executableString, c, errorNumber, tempString); if (tempString) CFRelease(tempString); if (executableString) CFRelease(executableString); } } } else { if (error) { localError = _CFBundleCreateError(CFGetAllocator(bundle), bundle, CFBundleExecutableNotFoundError); } else { CFLog(__kCFLogBundle, CFSTR("Cannot find executable for bundle %@"), bundle); } } if (executableURL) CFRelease(executableURL); } if (!bundle->_isLoaded && error) *error = localError; return bundle->_isLoaded;}
开发者ID:parkera,项目名称:swift-corelibs-foundation,代码行数:51,
示例17: ofEnableAlphaBlending//--------------------------------------------------------------void BoxWorldApp::setup(){ ofEnableAlphaBlending(); ofDisableArbTex(); string data_resource_path;#ifdef TARGET_OSX // Get the absolute location of the executable file in the bundle. CFBundleRef appBundle = CFBundleGetMainBundle(); CFURLRef executableURL = CFBundleCopyExecutableURL(appBundle); CFURLRef dataPrefixURL = CFBundleCopyBundleURL(appBundle); char execFile[4096]; if (CFURLGetFileSystemRepresentation(executableURL, TRUE, (UInt8 *)execFile, 4096)) { // Strip out the filename to just get the path string strExecFile = execFile; int found = strExecFile.find_last_of("/"); string strPath = strExecFile.substr(0, found); // Change the working directory to that of the executable if(-1 == chdir(strPath.c_str())) { ofLog(OF_LOG_ERROR, "Unable to change working directory to executable's directory."); } } else { ofLog(OF_LOG_ERROR, "Unable to identify executable's directory."); } CFRelease(executableURL); char dataPrefix[4096]; if (CFURLGetFileSystemRepresentation(dataPrefixURL, TRUE, (UInt8 *)dataPrefix, 4096)) { string strExecFile = dataPrefix; int found = strExecFile.find_last_of("/"); string strPath = strExecFile.substr(0, found); data_resource_path = strPath.append("/data/"); }#endif /* Init according to manifest file. */ ResourceMgrInst::get()->setRootDir(data_resource_path); /* Init connection manager for incoming message handling. */ ConnMgrInst::get()->setCmdReceiver(this); ofSetDataPathRoot(data_resource_path); mShaderExecutor = new ShaderExecutor(BOXWORLD_WIDTH, BOXWORLD_HEIGHT); if(ResourceMgrInst::get()->isDefaultAppValid()) { runAppWithContent(ResourceMgrInst::get()->getDefAppContent()); }}
开发者ID:BoxWorld,项目名称:BoxWorld,代码行数:52,
示例18: get_my_pathvoid get_my_path(char s[PATH_MAX]){ CFBundleRef mainBundle = CFBundleGetMainBundle(); CFURLRef executableURL = CFBundleCopyExecutableURL(mainBundle); CFStringRef executablePathString = CFURLCopyFileSystemPath(executableURL, kCFURLPOSIXPathStyle); CFRelease(executableURL); CFStringGetFileSystemRepresentation(executablePathString, s, PATH_MAX-1); CFRelease(executablePathString); char *x; x = strrchr(s, '/'); if(x) x[1] = 0;}
开发者ID:ChArce,项目名称:platform_system_core,代码行数:14,
示例19: CFBundleCreatePRBool nsPluginsDir::IsPluginFile(nsIFile* file){ CFURLRef pluginURL = NULL; if (NS_FAILED(toCFURLRef(file, pluginURL))) return PR_FALSE; PRBool isPluginFile = PR_FALSE; CFBundleRef pluginBundle = CFBundleCreate(kCFAllocatorDefault, pluginURL); if (pluginBundle) { UInt32 packageType, packageCreator; CFBundleGetPackageInfo(pluginBundle, &packageType, &packageCreator); if (packageType == 'BRPL' || packageType == 'IEPL' || packageType == 'NSPL') { CFURLRef executableURL = CFBundleCopyExecutableURL(pluginBundle); if (executableURL) { isPluginFile = IsLoadablePlugin(executableURL); CFRelease(executableURL); } } // some safari plugins that we can't use don't have resource forks short refNum; if (isPluginFile) { refNum = OpenPluginResourceFork(file); if (refNum < 0) { isPluginFile = PR_FALSE; } else { ::CloseResFile(refNum); } } CFRelease(pluginBundle); } else { LSItemInfoRecord info; if (LSCopyItemInfoForURL(pluginURL, kLSRequestTypeCreator, &info) == noErr) { if ((info.filetype == 'shlb' && info.creator == 'MOSS') || info.filetype == 'NSPL' || info.filetype == 'BRPL' || info.filetype == 'IEPL') { isPluginFile = IsLoadablePlugin(pluginURL); } } } CFRelease(pluginURL); return isPluginFile;}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:48,
|