您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CFBundleCopyBundleURL函数代码示例

51自学网 2021-06-01 19:58:21
  C++
这篇教程C++ CFBundleCopyBundleURL函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CFBundleCopyBundleURL函数的典型用法代码示例。如果您正苦于以下问题:C++ CFBundleCopyBundleURL函数的具体用法?C++ CFBundleCopyBundleURL怎么用?C++ CFBundleCopyBundleURL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CFBundleCopyBundleURL函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: binaryPath

QString config::prefix() {#ifdef Q_OS_WIN32  QDir binaryPath(QCoreApplication::applicationDirPath());  return QDir::toNativeSeparators(binaryPath.canonicalPath());#endif#ifdef Q_OS_LINUX  QString basePath(qgetenv("PLEXYDESK_DIR"));  if (basePath.isEmpty() || basePath.isNull()) {    return PLEXYPREFIX;  }  return basePath;#endif#ifdef Q_OS_MAC  CFURLRef appUrlRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());  CFStringRef macPath =      CFURLCopyFileSystemPath(appUrlRef, kCFURLPOSIXPathStyle);  const char *pathPtr =      CFStringGetCStringPtr(macPath, CFStringGetSystemEncoding());  CFRelease(appUrlRef);  CFRelease(macPath);  return QLatin1String(pathPtr) + QString("/Contents/");#endif  return QString();}
开发者ID:shaheeqa,项目名称:plexydesk,代码行数:28,


示例2: GetStartOnSystemStartup

bool GetStartOnSystemStartup(){    CFURLRef bitcoinAppUrl = CFBundleCopyBundleURL(CFBundleGetMainBundle());    LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);    LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl);    return !!foundItem; // return boolified object}
开发者ID:Cataloniacoin,项目名称:CataloniacoinS,代码行数:7,


示例3: macSetBundlePath

// dynamic data path detection onmacbool macSetBundlePath(char* buffer){    // the following code will enable mupen to find its data when placed in an app bundle on mac OS X.    // returns true if path is set, returns false if path was not set    char path[1024] = { 0 };    CFBundleRef main_bundle = CFBundleGetMainBundle(); assert(main_bundle);    CFURLRef main_bundle_URL = CFBundleCopyBundleURL(main_bundle); assert(main_bundle_URL);    CFStringRef cf_string_ref = CFURLCopyFileSystemPath( main_bundle_URL, kCFURLPOSIXPathStyle); assert(cf_string_ref);    CFStringGetCString(cf_string_ref, path, 1024, kCFStringEncodingASCII);    CFRelease(main_bundle_URL);    CFRelease(cf_string_ref);        if (strstr( path, ".app" ) != 0)    {        DebugMessage(M64MSG_VERBOSE, "checking whether we are using an app bundle: yes");        // executable is inside an app bundle, use app bundle-relative paths        sprintf(buffer, "%s/Contents/Resources/", path);        return true;    }    else    {        DebugMessage(M64MSG_VERBOSE, "checking whether we are using an app bundle: no");        return false;    }}
开发者ID:Gillou68310,项目名称:mupen64plus-core,代码行数:26,


示例4: main

int main(int argc, char *argv[]){#ifdef WIN32    qInstallMsgHandler(myMessageOutput);#endif#if defined(Q_OS_MACX)    // On Mac, switch working directory to resources folder    CFURLRef pluginRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());    CFStringRef macPath = CFURLCopyFileSystemPath(pluginRef, kCFURLPOSIXPathStyle);    QString path( CFStringGetCStringPtr(macPath, CFStringGetSystemEncoding()) );    path += "/Contents/Resources";    QDir::setCurrent( path );    CFRelease(pluginRef);    CFRelease(macPath);#elif defined(PO_DATA_REPO)    QDir::setCurrent(PO_DATA_REPO);#endif    srand(time(NULL));    try    {        //HotKeyClass HotKeyEvent;	QApplication a(argc, argv);        //a.installEventFilter(&HotKeyEvent);	/* Names to use later for QSettings */        QCoreApplication::setApplicationName("Pokeymon-Online");	QCoreApplication::setOrganizationName("Dreambelievers");        QSettings settings;        if (settings.value("language").isNull()) {            settings.setValue("language", QLocale::system().name().section('_', 0, 0));        }        QString locale = settings.value("language").toString();        QTranslator translator;        translator.load(QString("trans/translation_") + locale);        a.installTranslator(&translator);        /* icon ;) */#if not defined(Q_OS_MACX)	a.setWindowIcon(QIcon("db/icon.png"));#endif        MainEngine w;        return a.exec();    }  /*catch (const std::exception &e) {        qDebug() << "Caught runtime " << e.what();    } catch (const QString &s) {        qDebug() << "Caught string " << s;    } */catch (const char* s) {        qDebug() << "Caught const char*  " << s;    } /*catch (...) {        qDebug() << "Caught Exception.";    }*/    return 0;}
开发者ID:ShinyCrobat,项目名称:pokemon-online,代码行数:59,


示例5: mBundle

Bundle::Bundle(CFBundleRef bundle, const char *root /* = NULL */)	: mBundle(bundle){	assert(bundle);	CFRetain(bundle);	mPath = root ? root : cfStringRelease(CFBundleCopyBundleURL(mBundle));	secdebug("bundle", "%p Bundle from bundle %p(%s)", this, bundle, mPath.c_str());}
开发者ID:Proteas,项目名称:codesign,代码行数:8,


示例6: open_libgl

static void open_libgl(void){    bundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengles")); // we are always linked to OpenGLES.framework statically, so it is already loaded and could be found by id    assert(bundle != NULL);        CFRetain(bundle);    bundleURL = CFBundleCopyBundleURL(bundle);}
开发者ID:OGRECave,项目名称:ogre,代码行数:8,


示例7: InitDirs

void InitDirs(const std::string& argv0) {    if (g_initialized)        return;    // store working dir    fs::initial_path();    fs::path bundle_path;    fs::path app_path;    CFBundleRef bundle = CFBundleGetMainBundle();    char bundle_dir[MAXPATHLEN];    if (bundle) {        CFURLRef bundleurl = CFBundleCopyBundleURL(bundle);        CFURLGetFileSystemRepresentation(bundleurl, true, reinterpret_cast<UInt8*>(bundle_dir), MAXPATHLEN);    } else {        // executable is not the main binary in application bundle (i.e. Server or AI)        uint32_t size = sizeof(bundle_dir);        if (_NSGetExecutablePath(bundle_dir, &size) != 0) {            std::cerr << "_NSGetExecutablePath() failed: buffer too small; need size " << size << std::endl;            exit(-1);        }    }    bundle_path = fs::path(bundle_dir);    // search bundle_path for a directory named "FreeOrion.app", exiting if not found, else constructing a path to application bundle contents    fs::path::iterator appiter =   std::find(bundle_path.begin(), bundle_path.end(), "FreeOrion.app");    if (appiter == bundle_path.end()) {        std::cerr << "Error: Application bundle must be named 'FreeOrion.app' and executables must not be called from outside of it." << std::endl;        exit(-1);    } else {        for (fs::path::iterator piter = bundle_path.begin(); piter != appiter; ++piter) {            app_path /= *piter;        }        app_path /= "FreeOrion.app/Contents";    }    s_root_data_dir =   app_path / "Resources";    s_user_dir      =   fs::path(getenv("HOME")) / "Library" / "Application Support" / "FreeOrion";    s_bin_dir       =   app_path / "Executables";    s_config_path   =   s_user_dir / "config.xml";    s_python_home   =   app_path / "Frameworks" / "Python.framework" / "Versions" / "Current";    fs::path p = s_user_dir;    if (!exists(p))        fs::create_directories(p);    p /= "save";    if (!exists(p))        fs::create_directories(p);    // Intentionally do not create the server save dir.    // The server save dir is publically accessible and should not be    // automatically created for the user.    g_initialized = true;}
开发者ID:cpeosphoros,项目名称:freeorion,代码行数:58,


示例8: FSGetApplPath

bool FSGetApplPath(UniString &applPath, bool withPS/* = true*/){#if defined(WIN32) || defined(_WIN32_WCE)    wchar_t    Temp[_MAX_PATH+1] = L"";#if defined(_WIN32_WCE)	::GetModuleFileName(NULL, Temp, _MAX_PATH);#else	::GetModuleFileNameW(NULL, Temp, _MAX_PATH);#endif	applPath = Temp;	STRIndex_t pos = applPath.FindRAt(PATH_SEPARATOR_CHAR);	if ( STRING_FOUND(pos) )		applPath.Truncate( withPS ? pos + 1 : pos);	return true;#else	CFBundleRef	bundleRef = CFBundleGetMainBundle();	if ( bundleRef == NULL ) return false;	CFURLRef	urlRef = CFBundleCopyBundleURL(bundleRef);	CFRelease(bundleRef);	if ( urlRef )	{		CFStringRef	stringRef = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle);		CFRelease(urlRef);		if ( stringRef )		{			applPath = stringRef;			CFRelease(stringRef);				STRIndex_t pos = applPath.FindRAt(PATH_SEPARATOR_CHAR);			if ( STRING_FOUND(pos) )			{				if (!withPS)					applPath.Truncate(pos);			}			else			{				if (withPS)					applPath += PATH_SEPARATOR_CHAR;			}			return true;		}	}	return false;#endif}
开发者ID:kjoon010,项目名称:IncubeTech-Contribs,代码行数:58,


示例9: bundles

/* -----------------------------------------------------------------------------plugin entry point, called by vpndref is the vpn bundle referencepppref is the ppp bundle referencebundles can be layout in two different ways- As simple vpn bundles (bundle.vpn). the bundle contains the vpn bundle binary.- As full ppp bundles (bundle.ppp). The bundle contains the ppp bundle binary, and also the vpn kext and the vpn bundle binary in its Plugins directory.if a simple vpn bundle was used, pppref will be NULL.if a ppp bundle was used, the vpn plugin will be able to get access to the Plugins directory and load the vpn kext.----------------------------------------------------------------------------- */int start(struct vpn_channel* the_vpn_channel, CFBundleRef ref, CFBundleRef pppref, int debug_mode){    char 	name[MAXPATHLEN];     CFURLRef	url;    debug = debug_mode;        /* first load the kext if we are loaded as part of a ppp bundle */    if (pppref) {        while ((listen_sockfd = socket(PF_PPP, SOCK_DGRAM, PPPPROTO_L2TP)) < 0)            if (errno != EINTR)                break;        if (listen_sockfd < 0) {            vpnlog(LOG_DEBUG, "first call to socket failed - attempting to load kext/n");            if (url = CFBundleCopyBundleURL(pppref)) {                name[0] = 0;                CFURLGetFileSystemRepresentation(url, 0, name, MAXPATHLEN - 1);                CFRelease(url);                strcat(name, "/");                if (url = CFBundleCopyBuiltInPlugInsURL(pppref)) {                    CFURLGetFileSystemRepresentation(url, 0, name + strlen(name),                                 MAXPATHLEN - strlen(name) - strlen(L2TP_NKE) - 1);                    CFRelease(url);                    strcat(name, "/");                    strcat(name, L2TP_NKE);                    if (!load_kext(name))                        while ((listen_sockfd = socket(PF_PPP, SOCK_DGRAM, PPPPROTO_L2TP)) < 0)                            if (errno != EINTR)                                break;                }	            }            if (listen_sockfd < 0) {                vpnlog(LOG_ERR, "VPND L2TP plugin: Unable to load L2TP kernel extension/n");                return -1;            }        }    }        /* retain reference */    bundle = ref;    CFRetain(bundle);        pppbundle = pppref;    CFRetain(pppbundle);                // hookup our socket handlers    bzero(the_vpn_channel, sizeof(struct vpn_channel));    the_vpn_channel->get_pppd_args = l2tpvpn_get_pppd_args;    the_vpn_channel->listen = l2tpvpn_listen;    the_vpn_channel->accept = l2tpvpn_accept;    the_vpn_channel->refuse = l2tpvpn_refuse;    the_vpn_channel->close = l2tpvpn_close;    return 0;}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:68,


示例10: start

/* -----------------------------------------------------------------------------plugin entry point, called by pppd----------------------------------------------------------------------------- */int start(CFBundleRef ref){    CFStringRef 	strref;    CFURLRef 		urlref;       bundle = ref;    CFRetain(bundle);        url = CFBundleCopyBundleURL(bundle);    // hookup our handlers    old_check_options = the_channel->check_options;    the_channel->check_options = serial_check_options;        old_connect = the_channel->connect;    the_channel->connect = serial_connect;        old_process_extra_options = the_channel->process_extra_options;    the_channel->process_extra_options = serial_process_extra_options;    add_notifier(&connect_fail_notify, serial_connect_notifier, 0);    add_notifier(&lcp_lowerdown_notify, serial_lcpdown_notifier, 0);    cancelstrref = CFBundleCopyLocalizedString(bundle, CFSTR("Cancel"), CFSTR("Cancel"), NULL);    if (cancelstrref == 0) return 1;    CFStringGetCString(cancelstrref, (char*)cancelstr, sizeof(cancelstr), kCFStringEncodingUTF8);        icstrref = CFBundleCopyLocalizedString(bundle, CFSTR("Network Connection"), CFSTR("Network Connection"), NULL);    if (icstrref == 0) return 1;    CFStringGetCString(icstrref, (char*)icstr, sizeof(icstr), kCFStringEncodingUTF8);        urlref = CFBundleCopyResourceURL(bundle, CFSTR("NetworkConnect.icns"), NULL, NULL);    if (urlref == 0 || ((strref = CFURLGetString(urlref)) == 0)) {		if (urlref)            CFRelease(urlref);        return 1;    }    CFStringGetCString(strref, (char*)iconstr, sizeof(iconstr), kCFStringEncodingUTF8);		iconstrref = CFStringCreateCopy(NULL, strref);    CFRelease(urlref);	urlref = CFBundleCopyBuiltInPlugInsURL(bundle);	if (urlref == 0 || ((CFURLGetFileSystemRepresentation(urlref, TRUE, pathccl, sizeof(pathccl))) == FALSE)) {		if (urlref)            CFRelease(urlref);        return 1;    }    strlcat((char*)pathccl, SUFFIX_CCLENGINE, sizeof(pathccl));    CFRelease(urlref);        // add the socket specific options    add_options(serial_options);    return 0;}
开发者ID:Deanzou,项目名称:ppp,代码行数:59,


示例11: fill_pathname_application_path

void fill_pathname_application_path(char *buf, size_t size){   size_t i;   (void)i;   if (!size)      return;#ifdef _WIN32   DWORD ret = GetModuleFileName(GetModuleHandle(NULL), buf, size - 1);   buf[ret] = '/0';#elif defined(__APPLE__)   CFBundleRef bundle = CFBundleGetMainBundle();   if (bundle)   {      CFURLRef bundle_url = CFBundleCopyBundleURL(bundle);      CFStringRef bundle_path = CFURLCopyPath(bundle_url);      CFStringGetCString(bundle_path, buf, size, kCFStringEncodingUTF8);      CFRelease(bundle_path);      CFRelease(bundle_url);            rarch_assert(strlcat(buf, "nobin", size) < size);      return;   }#elif defined(__HAIKU__)   image_info info;   int32 cookie = 0;   while (get_next_image_info(0, &cookie, &info) == B_OK)   {      if (info.type == B_APP_IMAGE)      {         strlcpy(buf, info.name, size);         return;      }   }#else   *buf = '/0';   pid_t pid = getpid();    char link_path[PATH_MAX];   /* Linux, BSD and Solaris paths. Not standardized. */   static const char *exts[] = { "exe", "file", "path/a.out" };   for (i = 0; i < ARRAY_SIZE(exts); i++)   {      snprintf(link_path, sizeof(link_path), "/proc/%u/%s",            (unsigned)pid, exts[i]);      ssize_t ret = readlink(link_path, buf, size - 1);      if (ret >= 0)      {         buf[ret] = '/0';         return;      }   }      RARCH_ERR("Cannot resolve application path! This should not happen./n");#endif}
开发者ID:SuperrSonic,项目名称:RA-SS,代码行数:56,


示例12: getExecutablePath

    std::string getExecutablePath()    {      CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());      FixedStrT<512> buf;      CFURLGetFileSystemRepresentation(url, true,                       (UInt8*) buf.str(), buf.capacity());      return buf.str();    }
开发者ID:enuuros,项目名称:multitude,代码行数:10,


示例13: CFBundleCopyBundleURL

QDirlastfm::dir::bundle(){    // Trolltech provided example    CFURLRef appUrlRef = CFBundleCopyBundleURL( CFBundleGetMainBundle() );    CFStringRef macPath = CFURLCopyFileSystemPath( appUrlRef, kCFURLPOSIXPathStyle );    QString path = CFStringToQString( macPath );    CFRelease(appUrlRef);    CFRelease(macPath);    return QDir( path );}
开发者ID:dschmidt,项目名称:liblastfm,代码行数:11,


示例14: CFBundleCopyBundleURL

void WindowMenu::onBringAllToFront(){#ifdef Q_WS_MAC   CFURLRef appUrlRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());   if (appUrlRef)   {      LSOpenCFURLRef(appUrlRef, NULL);      CFRelease(appUrlRef);   }#endif}
开发者ID:Swissbanker,项目名称:rstudio,代码行数:11,


示例15: initialize

	void initialize()	{		static bool initialized = false;		if (initialized) {			return;		}		// Determine path for resources#ifdef TARGET_OSX		CFBundleRef mainBundle = CFBundleGetMainBundle();		if (mainBundle) {			boost::filesystem::path bundlePath = convertCFUrlToPath(CFBundleCopyBundleURL(mainBundle));			boost::filesystem::path resourcesPath = convertCFUrlToPath(CFBundleCopyResourcesDirectoryURL(mainBundle));			resources = bundlePath / resourcesPath;		}#elif TARGET_LINUX		resources = boost::filesystem::read_symlink(boost::filesystem::path("/proc/self/exe")).parent_path() / boost::filesystem::path("resources");#endif		if (!valid(resources)) {			throw std::runtime_error("Unable to determine resource directory!");		}		// Determine data path		char const* dataPathEnv = getenv(DATA_DIRECTORY_ENV_NAME.c_str());		if (dataPathEnv) {			data = boost::filesystem::path(dataPathEnv);		} else {			boost::filesystem::path userHome;			char const* home = util::coalesce(getenv("HOME"), getenv("USERPROFILE"));			if (home) {				userHome = boost::filesystem::path(home);			} else {				char const* homedrive = getenv("HOMEDRIVE");				char const* homepath = getenv("HOMEPATH");				if (homedrive && homepath) {					userHome = boost::filesystem::path(std::string(homedrive) + homepath);				}			}			if (!valid(userHome)) {				throw std::runtime_error("Unable to determine user home directory!");			}			data = userHome / DATA_DIRECTORY_DEFAULT_NAME;			ensureDirectoryExists(data);		}		initialized = true;	}
开发者ID:simonlmn,项目名称:actracktive,代码行数:53,


示例16: CFBundleCopyBundleURL

QString ScPaths::bundleDir(void) const{	// On MacOS/X, override the compile-time settings with a location// obtained from the system.#ifdef Q_WS_MAC	// Set up the various app paths to look inside the app bundle	CFURLRef pluginRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());	CFStringRef macPath = CFURLCopyFileSystemPath(pluginRef, kCFURLPOSIXPathStyle);	const char *pathPtr = CFStringGetCStringPtr(macPath, CFStringGetSystemEncoding());	if (pathPtr!=NULL && strlen(pathPtr)>0)	{		// make sure we get the Scribus.app directory, not some subdir		// strip trailing '/':		qDebug("Path = %s", pathPtr);		char *p = const_cast<char*>(pathPtr + strlen(pathPtr) - 1);		while (*p == '/')			--p;		++p;		*p = '/0';		if (strcmp("/bin", p-4) == 0) {			p -= 4;			*p = '/0';		}		if (strcmp("/MacOS", p-6) == 0) {			p -= 6;			*p = '/0';		}		if (strcmp("/Contents", p-9) == 0) {			p -= 9;			*p = '/0';		}		CFRelease(pluginRef);		CFRelease(macPath);		return QString("%1").arg(pathPtr);	}	else	{		char buf[2048];		CFStringGetCString (macPath, buf, 2048, kCFStringEncodingUTF8);		QString q_pathPtr=QString::fromUtf8(buf);		if (q_pathPtr.endsWith("/bin"))			q_pathPtr.chop(4);		if (q_pathPtr.endsWith("/MacOS"))			q_pathPtr.chop(6);		if (q_pathPtr.endsWith("/Contents"))			q_pathPtr.chop(9);		CFRelease(pluginRef);		CFRelease(macPath);		return q_pathPtr;	}#endif	return QString::null;}
开发者ID:piksels-and-lines-orchestra,项目名称:scribus,代码行数:53,


示例17: GetBundleDirectory

std::string GetBundleDirectory() {	CFURLRef BundleRef;	char AppBundlePath[MAXPATHLEN];	// Get the main bundle for the app	BundleRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());	CFStringRef BundlePath = CFURLCopyFileSystemPath(BundleRef, kCFURLPOSIXPathStyle);	CFStringGetFileSystemRepresentation(BundlePath, AppBundlePath, sizeof(AppBundlePath));	CFRelease(BundleRef);	CFRelease(BundlePath);	return AppBundlePath;}
开发者ID:john-peterson,项目名称:dolphin-emu,代码行数:13,


示例18: getMacJackPath

QString getMacJackPath(){    QString macPathq;    CFURLRef appUrlRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());    CFStringRef macPath = CFURLCopyFileSystemPath(appUrlRef, kCFURLPOSIXPathStyle);    const char *pathPtr = CFStringGetCStringPtr(macPath, CFStringGetSystemEncoding());    macPathq = QString::fromStdString(pathPtr);    CFRelease(appUrlRef);    CFRelease(macPath);    return macPathq + "/Contents/Resources/JackSms";}
开发者ID:freesmee,项目名称:freesmee-desktop,代码行数:13,


示例19: 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,


示例20: macBundlePath

	// This function will locate the path to our application on OS X,	// unlike windows you can not rely on the curent working directory	// for locating your configuration files and resources.	std::string macBundlePath()	{		char path[1024];		CFBundleRef mainBundle = CFBundleGetMainBundle();		assert(mainBundle);		CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);		assert(mainBundleURL);		CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);		assert(cfStringRef);		CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);		CFRelease(mainBundleURL);		CFRelease(cfStringRef);		return std::string(path);	}
开发者ID:2asoft,项目名称:MMO-Framework,代码行数:17,


示例21: CFBundleGetMainBundle

const GHOST_TUns8* GHOST_SystemPathsCarbon::getBinaryDir() const{    CFURLRef bundleURL;    CFStringRef pathStr;    static char path[256];    CFBundleRef mainBundle = CFBundleGetMainBundle();    bundleURL = CFBundleCopyBundleURL(mainBundle);    pathStr = CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle);    CFStringGetCString(pathStr, path, 255, kCFStringEncodingASCII);    CFRelease(pathStr);    CFRelease(bundleURL);    return (GHOST_TUns8*)path;}
开发者ID:MakersF,项目名称:BlenderDev,代码行数:14,


示例22: get_my_path

void get_my_path(char s[PATH_MAX]){    CFBundleRef mainBundle = CFBundleGetMainBundle();    CFURLRef bundleURL = CFBundleCopyBundleURL(mainBundle);    CFStringRef bundlePathString = CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle);    CFRelease(bundleURL);    CFStringGetCString(bundlePathString, s, PATH_MAX - 1, kCFStringEncodingASCII);    CFRelease(bundlePathString);	char *x;    x = strrchr(s, '/');    if(x) x[1] = 0;}
开发者ID:Kcwind,项目名称:platform_system_core,代码行数:14,


示例23: CFBundleCopyBundleURL

//--------------------------------------------------------------string osxVoiceOverApp::getAppPathDirectory(){		// Get the path the correct apple way - returns path to inside .app directory	CFURLRef mainRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());	CFStringRef macPath = CFURLCopyFileSystemPath(mainRef, kCFURLPOSIXPathStyle);	const char *pathPtr = CFStringGetCStringPtr(macPath, CFStringGetSystemEncoding());	string pathDirectory (pathPtr);		size_t found;	found=pathDirectory.find_last_of("///");	pathDirectory = pathDirectory.substr(0,found+1);		return pathDirectory;}
开发者ID:JoshuaBatty,项目名称:CEMA,代码行数:15,


示例24: CFBundleGetBundleWithIdentifier

CFStringRef Resources::getResourcesPathFromBundleId() { //@@TODO    char buffer[PATH_MAX];    CFBundleRef bundle = CFBundleGetBundleWithIdentifier(CFSTR("SuperColldierAU") );    if (bundle == NULL) return NULL;    CFURLRef bundleURL = CFBundleCopyBundleURL(bundle);    CFURLGetFileSystemRepresentation(bundleURL, TRUE, (UInt8*)buffer,PATH_MAX);    CFStringRef bundlePath = CFStringCreateWithCString(NULL,buffer, kCFStringEncodingUTF8);    CFURLRef bundleResourcesURL = CFBundleCopyResourcesDirectoryURL(bundle);    CFStringRef resourcesRelativePath = CFURLGetString(bundleResourcesURL);    CFMutableStringRef resourcesPath = CFStringCreateMutable(NULL,0);    CFStringAppend(resourcesPath,bundlePath);    CFStringAppend(resourcesPath,resourcesRelativePath);    return resourcesPath;}
开发者ID:2mc,项目名称:supercollider,代码行数:14,


示例25: tmpSettings

void Autostart::SetActive( bool active ){#ifdef Q_OS_WIN  QString applicationName = QCoreApplication::applicationName();  QString applicationPath = QCoreApplication::applicationFilePath();  QSettings tmpSettings( "HKEY_CURRENT_USER//Software//Microsoft//Windows//CurrentVersion//Run", QSettings::NativeFormat );  if( active ) {    tmpSettings.setValue( applicationName,      QString( "/"%1/"" ).arg( QDir::toNativeSeparators( QFileInfo( applicationPath ).filePath() ) )    );  } else {    tmpSettings.remove(applicationName);  }#elif defined(Q_OS_MAC)  LSSharedFileListRef loginItems = LSSharedFileListCreate( NULL, kLSSharedFileListSessionLoginItems, NULL );  if( !loginItems )    return;  UInt32 seed = 0U;  CFArrayRef currentLoginItems = LSSharedFileListCopySnapshot( loginItems, &seed );  LSSharedFileListItemRef existingItem = FindLoginItemForCurrentBundle( currentLoginItems );  if( active && (existingItem == NULL) ) {    CFURLRef mainBundleURL = CFBundleCopyBundleURL( CFBundleGetMainBundle() );    LSSharedFileListInsertItemURL( loginItems, kLSSharedFileListItemBeforeFirst, NULL, NULL, mainBundleURL, NULL, NULL );    CFRelease( mainBundleURL );  }  else if( !active && (existingItem != NULL) ) {    LSSharedFileListItemRemove(loginItems, existingItem);  }  CFRelease( currentLoginItems );  CFRelease( loginItems );#elif defined Q_OS_LINUX    QString homeLocation = QStandardPaths::writableLocation( QStandardPaths::HomeLocation );    QDir* autostartPath = new QDir(homeLocation + "/.config/autostart/");    if( !active ) {        QFile* desktopFile = new QFile(autostartPath->filePath("track-o-bot.desktop"));        desktopFile->remove();    } else {        QFile* srcFile = new QFile( ":/assets/track-o-bot.desktop" );        LOG("source: %s", srcFile->fileName().toStdString().c_str());        LOG("source exists: %s", QString::number(srcFile->exists()).toStdString().c_str());        srcFile->copy(autostartPath->filePath("track-o-bot.desktop"));    }#endif}
开发者ID:CodeSheng,项目名称:track-o-bot,代码行数:50,


示例26: fnm

	const char *getPath(const char *filename)	{#if defined __IOS__		char *ptr;		std::string fnm(filename);		if(fnm.find("/") != 0)		{			CFBundleRef mainBundle = CFBundleGetMainBundle();			CFURLRef resourcesURL = CFBundleCopyBundleURL(mainBundle);			CFStringRef str = CFURLCopyFileSystemPath(resourcesURL, kCFURLPOSIXPathStyle);			CFRelease(resourcesURL);			ptr = new char[CFStringGetLength(str)+1];			CFStringGetCString(str, ptr, FILENAME_MAX, kCFStringEncodingASCII);			CFRelease(str);			std::string res(ptr);			res += std::string("/");			res += std::string(filename);			delete[] ptr;			ptr = new char[res.length()+1];			strcpy(ptr, res.c_str());		}else		{			ptr = new char[fnm.length()+1];			strcpy(ptr, fnm.c_str());		}		return (const char*)ptr;#else		for(int i = 0; i < paths.size(); i++)		{			std::string str(filename);			str = *paths[i]+str;			std::ifstream in(str.c_str());			if(in.good())			{				char *ptr = new char[str.length()+1];				strcpy(ptr, str.c_str());				return (const char*)ptr;			}		}		char *ptr2 = new char[std::string(filename).length()+1];		strcpy(ptr2, filename);        return (const char*)ptr2;#endif	}
开发者ID:lynxluna,项目名称:isdge,代码行数:49,


示例27: GetApplicationPackageFSSpecFromBundle

OSErr GetApplicationPackageFSSpecFromBundle(FSSpecPtr theFSSpecPtr) {  OSErr err = fnfErr;  CFBundleRef myAppsBundle = CFBundleGetMainBundle();  if (myAppsBundle == NULL) return err;  CFURLRef myBundleURL = CFBundleCopyBundleURL(myAppsBundle);  if (myBundleURL == NULL) return err;  FSRef myBundleRef;  Boolean ok = CFURLGetFSRef(myBundleURL, &myBundleRef);  CFRelease(myBundleURL);  if (!ok) return err;  return FSGetCatalogInfo(&myBundleRef, kFSCatInfoNone,    NULL, NULL, theFSSpecPtr, NULL);}
开发者ID:gzoppetti,项目名称:ExscitechVmd,代码行数:15,


示例28: get

boolCFCBundle::GetPath (char *dst, size_t dst_len){    CFBundleRef bundle = get();    if (bundle)    {        CFCReleaser<CFURLRef> bundle_url (CFBundleCopyBundleURL (bundle));        if (bundle_url.get())        {            Boolean resolveAgainstBase = 0;            return ::CFURLGetFileSystemRepresentation (bundle_url.get(), resolveAgainstBase, (UInt8 *)dst, dst_len) != 0;        }    }    return false;}   
开发者ID:32bitmicro,项目名称:riscv-lldb,代码行数:15,


示例29: CopyMacBundlePath

CFStringRef CopyMacBundlePath(){    CFBundleRef mainBundle = CFBundleGetMainBundle();    assert(mainBundle);	    CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);    assert(mainBundleURL);	    CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);    assert(cfStringRef);	    CFRelease(mainBundleURL);	    return cfStringRef;}
开发者ID:deardaniel,项目名称:PizzaTest,代码行数:15,


示例30: CFBundleGetMainBundle

bool EDA_APP::SetBinDir(){// Apple MacOSx#ifdef __APPLE__    // Derive path from location of the app bundle    CFBundleRef mainBundle = CFBundleGetMainBundle();    if( mainBundle == NULL )        return false;    CFURLRef urlref = CFBundleCopyBundleURL( mainBundle );    if( urlref == NULL )        return false;    CFStringRef str = CFURLCopyFileSystemPath( urlref, kCFURLPOSIXPathStyle );    if( str == NULL )        return false;    char* native_str = NULL;    int   len = CFStringGetMaximumSizeForEncoding( CFStringGetLength( str ),                                                   kCFStringEncodingUTF8 ) + 1;    native_str = new char[len];    CFStringGetCString( str, native_str, len, kCFStringEncodingUTF8 );    m_BinDir = FROM_UTF8( native_str );    delete[] native_str;#elif defined(__UNIX__)     // Linux and non-Apple Unix    m_BinDir = wxStandardPaths::Get().GetExecutablePath();#else    m_BinDir = argv[0];#endif    // Use unix notation for paths. I am not sure this is a good idea,    // but it simplify compatibility between Windows and Unices    // However it is a potential problem in path handling under Windows    m_BinDir.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );    // Remove file name form command line:    while( m_BinDir.Last() != '/' && !m_BinDir.IsEmpty() )        m_BinDir.RemoveLast();    return true;}
开发者ID:p12tic,项目名称:kicad-source-mirror,代码行数:48,



注:本文中的CFBundleCopyBundleURL函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CFBundleCopyExecutableURL函数代码示例
C++ CFBooleanGetValue函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。