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

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

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

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

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

示例1: _dyld_image_count

CFStringRef Resources::getResourcesPathFromDyldImage(){	const mach_header* header;	header = (mach_header*)&_mh_bundle_header;	const char* image_name = 0;	char buffer[PATH_MAX];	int cnt = _dyld_image_count();	for (int i = 1; i < cnt; i++)	{		if (_dyld_get_image_header((unsigned long)i) == header)		{			image_name = _dyld_get_image_name(i);			break;		}	}	CFURLRef executableURL = CFURLCreateFromFileSystemRepresentation (kCFAllocatorDefault, (const unsigned char*)image_name, strlen (image_name), false);	CFURLRef bundleContentsMacOSURL = CFURLCreateCopyDeletingLastPathComponent (kCFAllocatorDefault, executableURL);	CFRelease (executableURL);    CFURLRef bundleContentsURL = CFURLCreateCopyDeletingLastPathComponent (kCFAllocatorDefault, bundleContentsMacOSURL);    CFRelease (bundleContentsMacOSURL);    CFURLRef bundleURL = CFURLCreateCopyDeletingLastPathComponent (kCFAllocatorDefault, bundleContentsURL);    CFRelease (bundleContentsURL);    CFBundleRef bundle = CFBundleCreate (kCFAllocatorDefault, bundleURL);    CFURLRef bundleResourcesURL = CFBundleCopyResourcesDirectoryURL(bundle);	CFURLGetFileSystemRepresentation(bundleResourcesURL, TRUE, (UInt8*)buffer,PATH_MAX);	CFStringRef path = CFStringCreateWithCString(NULL,buffer, kCFStringEncodingUTF8);	return path;}
开发者ID:2mc,项目名称:supercollider,代码行数:29,


示例2: getPath

std::string getPath(){    std::string fullpath;    // ----------------------------------------------------------------------------    // This makes relative paths work in C++ in Xcode by changing directory to the Resources folder inside the .app bundle#ifdef __APPLE__    CFBundleRef mainBundle = CFBundleGetMainBundle();    CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);    char path[PATH_MAX];    if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))    {        // error!    }    CFRelease(resourcesURL);    chdir(path);    fullpath = path;#else	 char cCurrentPath[1024];	 if (!GetCurrentDir(cCurrentPath, sizeof(cCurrentPath)))		 return "";	cCurrentPath[sizeof(cCurrentPath) - 1] = '/0';	fullpath = cCurrentPath;#endif        return fullpath;}
开发者ID:jagenjo,项目名称:TJE_Framework,代码行数:27,


示例3: SetupDefaultDirs

bool SetupDefaultDirs(const char *exefilepath, const char *auxfilepath, bool forcecommandline){    datadir = StripFilePart(exefilepath);    auxdir = auxfilepath ? StripFilePart(SanitizePath(auxfilepath).c_str()) : datadir;    writedir = auxdir;    #ifdef __APPLE__        if (!forcecommandline)        {            // default data dir is the Resources folder inside the .app bundle            CFBundleRef mainBundle = CFBundleGetMainBundle();            CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);            char path[PATH_MAX];            auto res = CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX);            CFRelease(resourcesURL);            if (!res)                return false;            datadir = string(path) + "/";            #ifdef __IOS__                writedir = StripFilePart(path) + "Documents/"; // there's probably a better way to do this in CF            #else                writedir = datadir; // FIXME: this should probably be ~/Library/Application Support/AppName, but for now this works for non-app store apps            #endif        }    #elif defined(ANDROID)        datadir = "/Documents/Lobster/";  // FIXME: temp solution        writedir = datadir;    #endif    return true;  }
开发者ID:tom-seddon,项目名称:lobster,代码行数:31,


示例4: _glfwChangeToResourcesDirectory

void _glfwChangeToResourcesDirectory( void ){    CFBundleRef mainBundle = CFBundleGetMainBundle();    CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL( mainBundle );    char resourcesPath[ _GLFW_MAX_PATH_LENGTH ];        CFStringRef lastComponent = CFURLCopyLastPathComponent( resourcesURL );    if ( kCFCompareEqualTo != CFStringCompare(            CFSTR( "Resources" ),            lastComponent,            0 ) )    {        UNBUNDLED;    }        CFRelease( lastComponent );    if( !CFURLGetFileSystemRepresentation( resourcesURL,                                           TRUE,                                           (UInt8*)resourcesPath,                                           _GLFW_MAX_PATH_LENGTH ) )    {        CFRelease( resourcesURL );        UNBUNDLED;    }    CFRelease( resourcesURL );    if( chdir( resourcesPath ) != 0 )    {        UNBUNDLED;    }}
开发者ID:x-y-z,项目名称:SteerSuite-CUDA,代码行数:33,


示例5: _expand_resources

static int_expand_resources(krb5_context context, PTYPE param, const char *postfix, char **str){    char path[MAXPATHLEN];    CFBundleRef appBundle = CFBundleGetMainBundle();    if (appBundle == NULL)	return KRB5_CONFIG_BADFORMAT;    /*      * Check if there is an Info.plist, if not, then its is not a real     * bundle and skip     */    CFDictionaryRef infoPlist = CFBundleGetInfoDictionary(appBundle);    if (infoPlist == NULL || CFDictionaryGetCount(infoPlist) == 0)	return KRB5_CONFIG_BADFORMAT;    CFURLRef resourcesDir = CFBundleCopyResourcesDirectoryURL(appBundle);    if (resourcesDir == NULL)	return KRB5_CONFIG_BADFORMAT;    if (!CFURLGetFileSystemRepresentation(resourcesDir, true, (UInt8 *)path, sizeof(path))) {	CFRelease(resourcesDir);	return ENOMEM;    }    CFRelease(resourcesDir);    *str = strdup(path);    if (*str == NULL)	return ENOMEM;    return 0;}
开发者ID:aosm,项目名称:Heimdal,代码行数:34,


示例6: SDL_Init

	SDLApplication::SDLApplication () {				SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER);				currentUpdate = 0;		lastUpdate = 0;		nextUpdate = 0;				KeyEvent keyEvent;		MouseEvent mouseEvent;		RenderEvent renderEvent;		TouchEvent touchEvent;		UpdateEvent updateEvent;		WindowEvent windowEvent;				#ifdef HX_MACOS		CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL (CFBundleGetMainBundle ());		char path[PATH_MAX];				if (CFURLGetFileSystemRepresentation (resourcesURL, TRUE, (UInt8 *)path, PATH_MAX)) {						chdir (path);					}				CFRelease (resourcesURL);		#endif			}
开发者ID:mandel59,项目名称:lime,代码行数:29,


示例7: dataNode

void OSystem_SDL::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {#ifdef DATA_PATH	// Add the global DATA_PATH to the directory search list	// FIXME: We use depth = 4 for now, to match the old code. May want to change that	Common::FSNode dataNode(DATA_PATH);	if (dataNode.exists() && dataNode.isDirectory()) {		s.add(DATA_PATH, new Common::FSDirectory(dataNode, 4), priority);	}#endif#ifdef MACOSX	// Get URL of the Resource directory of the .app bundle	CFURLRef fileUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());	if (fileUrl) {		// Try to convert the URL to an absolute path		UInt8 buf[MAXPATHLEN];		if (CFURLGetFileSystemRepresentation(fileUrl, true, buf, sizeof(buf))) {			// Success: Add it to the search path			Common::String bundlePath((const char *)buf);			s.add("__OSX_BUNDLE__", new Common::FSDirectory(bundlePath), priority);		}		CFRelease(fileUrl);	}#endif}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:28,


示例8: defined

// Get all filenames and directoriesvoidPingusMain::init_path_finder(){  if (cmd_options.userdir.is_set())    System::set_userdir(cmd_options.userdir.get());  System::init_directories();  if (cmd_options.datadir.is_set())  {    g_path_manager.set_path(cmd_options.datadir.get());  }  else  { // do magic to guess the datadir#if defined(__APPLE__)    char resource_path[PATH_MAX];    CFURLRef ref = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());    if (!ref || !CFURLGetFileSystemRepresentation(ref, true, (UInt8*)resource_path, PATH_MAX))    {      std::cout << "Error: Couldn't get Resources path./n" << std::endl;      exit(EXIT_FAILURE);    }    CFRelease(ref);    g_path_manager.set_path("data");#else    g_path_manager.set_path("data"); // assume game is run from source dir#endif  }  // Language is automatically picked from env variable  //dictionary_manager.set_language(tinygettext::Language::from_env("it_IT.utf8")); // maybe overwritten by file ~/.pingus/config  dictionary_manager.add_directory(g_path_manager.complete("po/"));}
开发者ID:liushuyu,项目名称:aosc-os-abbs,代码行数:34,


示例9: main

int main(int argc, char *argv[])#endif{#ifdef __APPLE__    CFBundleRef mainBundle = CFBundleGetMainBundle();    CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);    char path[PATH_MAX];    if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))    {        // error!        std::cerr << "PATH ERROR " << __FILE__ << ": " << __LINE__ << std::endl;    }    CFRelease(resourcesURL);    chdir(path); // cd in    psc::Conf::i().init(path);#elif _SHOOTING_CUBES_ANDROID_    app_dummy();    char buf[256] = {0};    getcwd(buf, 256);    chdir(app->activity->internalDataPath);    LOGI("cwd: %s", buf);    unpack_data(app);    psc::Conf::i().init("", app->activity->internalDataPath, app->activity->externalDataPath);    psc::App::i().init(app).launchOpening2().run();    IrrDevice::i().~IrrDevice(); // manually destruct here, as IrrEx17 example?#else    psc::Conf::i().init(""); // doesn't need to find working_path on win32, not sure about linux though    std::srand(std::time(0)^std::clock()); //  init srand for global rand...    //return psc::App::i().init().launchOpening().run();    return psc::App::i().init().launchOpening2().run();#endif}
开发者ID:godfat,项目名称:cubeat,代码行数:32,


示例10: fs_helpers_apple_init

/*=================fs_helpers_apple_init=================*/erbool fs_helpers_apple_init (void){    CFURLRef url;    if (NULL == (cg_main_bundle = CFBundleGetMainBundle()))    {        sys_printf("CFBundleGetMainBundle failed/n");        return false;    }    if (NULL == (url = CFBundleCopyResourcesDirectoryURL(cg_main_bundle)))    {        sys_printf("CFBundleCopyResourcesDirectoryURL failed/n");        CFRelease(cg_main_bundle);        return false;    }    fs_get_documents_path(paths[0].path, sizeof(paths[0].path));    paths[0].valid = 1;    paths[0].rdonly = 0;    CFURLGetFileSystemRepresentation(url, true, (unsigned char *)paths[1].path, sizeof(paths[1].path));    CFRelease(url);    paths[1].valid = 1;    paths[1].rdonly = 1;    paths[2].valid = paths[3].valid = 0;    return true;}
开发者ID:eledot,项目名称:erszebet,代码行数:35,


示例11: pathForTool

static boolpathForTool(CFStringRef toolName, char path[MAXPATHLEN]){    CFBundleRef bundle;    CFURLRef resources;    CFURLRef toolURL;    Boolean success = true;        bundle = CFBundleGetMainBundle();    if (!bundle)        return FALSE;        resources = CFBundleCopyResourcesDirectoryURL(bundle);    if (!resources)        return FALSE;        toolURL = CFURLCreateCopyAppendingPathComponent(NULL, resources, toolName, FALSE);    CFRelease(resources);    if (!toolURL)        return FALSE;        success = CFURLGetFileSystemRepresentation(toolURL, TRUE, (UInt8 *)path, MAXPATHLEN);        CFRelease(toolURL);    return !access(path, X_OK);}
开发者ID:cylonbrain,项目名称:InsomniaX,代码行数:26,


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


示例13: main

int main(){#ifdef __APPLE__    CFBundleRef mainBundle = CFBundleGetMainBundle();    CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);    char path[PATH_MAX];    if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))        return 1;    CFRelease(resourcesURL);    chdir(path);#endif    try    {        FormBuilder app;        return app.run();    }    catch (std::exception e)    {        std::cerr << e.what() << std::endl;        return 1;    }    return 0;}
开发者ID:Goldenwing,项目名称:Hnefatafl,代码行数:27,


示例14: pathToResourceDirectory

string pathToResourceDirectory(){#ifdef __APPLE__	char path[MAXPATHLEN];	string tempString;	CFBundleRef bundle;	CFURLRef resDirURL;	path[0] = '/0';		bundle = CFBundleGetMainBundle();	if (!bundle) return string ("");	resDirURL = CFBundleCopyResourcesDirectoryURL(bundle);	if (!resDirURL) return string ("");	CFURLGetFileSystemRepresentation(resDirURL, TRUE, (UInt8 *)path, MAXPATHLEN);	CFRelease(resDirURL);		// put a trailing slash on the path	tempString = string(path);	tempString.append("/");	return tempString;#endif#ifdef _WIN32	return string("resources/");#endif}
开发者ID:Blz-Galaxy,项目名称:OpenGL_Animation_MT,代码行数:29,


示例15: main

int main(int argc, char *argv[]) {    std::ostream& stream = std::cout;    const char *parm = (argc > 1 ? argv[1] : 0);    stream << "welcome to goat attack ";    stream << GameVersion;    stream << ".../n" << std::endl;    init_hpet();    start_net();    try {        Configuration config(UserDirectory, ConfigFilename);#ifdef DEDICATED_SERVER        SubsystemNull subsystem(stream, "Goat Attack");#else        SubsystemSDL subsystem(stream, "Goat Attack", config.get_bool("shading_pipeline"));#endif#ifdef __APPLE__        CFBundleRef mainBundle = CFBundleGetMainBundle();        CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);        char path[PATH_MAX];        if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))        {            throw Exception("Cannot get bundle path");        }        CFRelease(resourcesURL);        std::string data_directory(path);        Resources resources(subsystem, data_directory);#else# ifdef DEDICATED_SERVER        const char *data_directory = STRINGIZE_VALUE_OF(DATA_DIRECTORY);# else        const char *data_directory = (parm ? parm : STRINGIZE_VALUE_OF(DATA_DIRECTORY));# endif        Resources resources(subsystem, data_directory);#endif        Game game(resources, subsystem, config);        game.run(parm ? parm : "");    } catch (const ResourcesMissingException& e) {        stream << std::endl << "ERROR: ";#ifdef DEDICATED_SERVER        stream << e.what() << std::endl;#else        stream << e.what() << std::endl;        stream << "Ensure that you can add a data folder as parameter." << std::endl;        stream << "Example: " << argv[0] << " path/to/your/data/folder" << std::endl;#endif    } catch (const Exception& e) {        stream << std::endl << "ERROR: ";        stream << e.what() << std::endl;    }    stop_net();    stream << "/nbye bye... :)" << std::endl;    return 0;}
开发者ID:goatattack,项目名称:goatattack,代码行数:59,


示例16: printf

SDLApplication::SDLApplication () {    if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER | SDL_INIT_TIMER | SDL_INIT_JOYSTICK) != 0) {        printf ("Could not initialize SDL: %s./n", SDL_GetError ());    }    currentApplication = this;    framePeriod = 1000.0 / 60.0;#ifdef EMSCRIPTEN    emscripten_cancel_main_loop ();    emscripten_set_main_loop (UpdateFrame, 0, 0);    emscripten_set_main_loop_timing (EM_TIMING_RAF, 1);#endif    currentUpdate = 0;    lastUpdate = 0;    nextUpdate = 0;    ApplicationEvent applicationEvent;    GamepadEvent gamepadEvent;    KeyEvent keyEvent;    MouseEvent mouseEvent;    RenderEvent renderEvent;    SensorEvent sensorEvent;    TextEvent textEvent;    TouchEvent touchEvent;    WindowEvent windowEvent;#if defined(IOS) || defined(ANDROID)    for (int i = 0; i < SDL_NumJoysticks (); i++) {        if (strstr (SDL_JoystickNameForIndex (i), "Accelerometer")) {            accelerometer = SDL_JoystickOpen (i);            accelerometerID = SDL_JoystickInstanceID (accelerometer);        }    }#endif#ifdef HX_MACOS    CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL (CFBundleGetMainBundle ());    char path[PATH_MAX];    if (CFURLGetFileSystemRepresentation (resourcesURL, TRUE, (UInt8 *)path, PATH_MAX)) {        chdir (path);    }    CFRelease (resourcesURL);#endif}
开发者ID:jobs-git,项目名称:lime,代码行数:59,


示例17: htmlURLRef

String WebInspectorProxy::inspectorBaseURL() const{    // Web Inspector uses localized strings, so it's not contained within inspector directory.    RetainPtr<CFURLRef> htmlURLRef(AdoptCF, CFBundleCopyResourcesDirectoryURL(webKitBundle()));    if (!htmlURLRef)        return String();    return String(CFURLGetString(htmlURLRef.get()));}
开发者ID:kcomkar,项目名称:webkit,代码行数:9,


示例18: CFBundleCopyResourcesDirectoryURL

char *HostFilesys::getDataFolder(char *buffer, unsigned int bufsize){	UInt8 main_bundle_loc[MAXPATHLEN];	CFURLRef url = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());	CFURLGetFileSystemRepresentation(url, true, main_bundle_loc, sizeof(main_bundle_loc));	CFRelease(url);	 	//printf("Data folder ---------> %s/n", main_bundle_loc);	return safe_strncpy(buffer, (char*)main_bundle_loc, bufsize);}
开发者ID:bobek,项目名称:aranym-debian,代码行数:10,


示例19: setcwd

void setcwd(void) {	// make sure cwd is where the app is (launching from Finder sets it to / by default)	unsigned char parentdir[MAXPATHLEN];	CFURLRef url = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());		if (CFURLGetFileSystemRepresentation(url, true, parentdir, MAXPATHLEN)) {		chdir((char *)parentdir);	}	CFRelease(url);}
开发者ID:AdamDiment,项目名称:CocoaSampleCode,代码行数:10,


示例20: bundle_path

char* bundle_path() {  CFBundleRef mainBundle = CFBundleGetMainBundle();  CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);  int len = 4096;  char* path = malloc(len);    CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8*)path, len);    return path;}
开发者ID:big538,项目名称:iOS-10.1.1-Project-0-Exploit-For-Jailbreak---F.C.E.-365-Fork-,代码行数:10,


示例21: application_path

const String application_path() {    cf::Url url(CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle()));    cf::String url_string(CFStringCreateCopy(NULL, CFURLGetString(url.c_obj())));    char path_buffer[PATH_MAX];    if (!CFURLGetFileSystemRepresentation(                url.c_obj(), true, reinterpret_cast<UInt8*>(path_buffer), PATH_MAX)) {        throw Exception("couldn't get application_path()");    }    return String(utf8::decode(path_buffer));}
开发者ID:Mailaender,项目名称:antares,代码行数:10,


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


示例23: CFBundleGetMainBundle

void RudeGlobals::GetPath(char *path){	#ifdef RUDE_IPHONE	CFBundleRef bundle = CFBundleGetMainBundle();	CFURLRef url = CFBundleCopyResourcesDirectoryURL(bundle);	CFStringRef cfpath = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);		CFStringGetCString(cfpath, path, 512, kCFStringEncodingASCII);#endif}
开发者ID:dreamsxin,项目名称:golf,代码行数:12,


示例24: initI18n

void initI18n(void){	const char *textdomainDirectory = NULL;	if (!setLanguage("")) // set to system default	{		// no system default?		debug(LOG_ERROR, "initI18n: No system language found");	}#if defined(WZ_OS_WIN)	{		// Retrieve an absolute path to the locale directory		char localeDir[PATH_MAX];		sstrcpy(localeDir, PHYSFS_getBaseDir());		sstrcat(localeDir, "//" LOCALEDIR);		// Set locale directory and translation domain name		textdomainDirectory = bindtextdomain(PACKAGE, localeDir);	}#else	#ifdef WZ_OS_MAC	{		char resourcePath[PATH_MAX];		CFURLRef resourceURL = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());		if( CFURLGetFileSystemRepresentation( resourceURL, true, (UInt8 *) resourcePath, PATH_MAX) )		{			sstrcat(resourcePath, "/locale");			textdomainDirectory = bindtextdomain(PACKAGE, resourcePath);		}		else		{			debug( LOG_ERROR, "Could not change to resources directory." );		}		if (resourceURL != NULL)		{			CFRelease(resourceURL);		}		debug(LOG_INFO, "resourcePath is %s", resourcePath);	}	#else	textdomainDirectory = bindtextdomain(PACKAGE, LOCALEDIR);	#endif#endif	if (!textdomainDirectory)	{		debug(LOG_ERROR, "initI18n: bindtextdomain failed!");	}	(void)bind_textdomain_codeset(PACKAGE, "UTF-8");	(void)textdomain(PACKAGE);}
开发者ID:JCDG,项目名称:warzone2100,代码行数:53,


示例25: printf

	SDLApplication::SDLApplication () {				if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER | SDL_INIT_TIMER | SDL_INIT_JOYSTICK) != 0) {						printf ("Could not initialize SDL: %s./n", SDL_GetError ());					}				SDL_LogSetPriority (SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN);				currentApplication = this;				framePeriod = 1000.0 / 60.0;				#ifdef EMSCRIPTEN		emscripten_cancel_main_loop ();		emscripten_set_main_loop (UpdateFrame, 0, 0);		emscripten_set_main_loop_timing (EM_TIMING_RAF, 1);		#endif				currentUpdate = 0;		lastUpdate = 0;		nextUpdate = 0;				ApplicationEvent applicationEvent;		DropEvent dropEvent;		GamepadEvent gamepadEvent;		JoystickEvent joystickEvent;		KeyEvent keyEvent;		MouseEvent mouseEvent;		RenderEvent renderEvent;		SensorEvent sensorEvent;		TextEvent textEvent;		TouchEvent touchEvent;		WindowEvent windowEvent;				SDL_EventState (SDL_DROPFILE, SDL_ENABLE);		SDLJoystick::Init ();				#ifdef HX_MACOS		CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL (CFBundleGetMainBundle ());		char path[PATH_MAX];				if (CFURLGetFileSystemRepresentation (resourcesURL, TRUE, (UInt8 *)path, PATH_MAX)) {						chdir (path);					}				CFRelease (resourcesURL);		#endif			}
开发者ID:andresa88,项目名称:lime,代码行数:53,


示例26: msGetExecutableDir

void msGetExecutableDir(string &path){    CFBundleRef mainBundle = CFBundleGetMainBundle();    CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);    char path1[PATH_MAX];    if (CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path1, PATH_MAX))    {        CFRelease(resourcesURL);                path = path1;    }    }
开发者ID:mikalai-silivonik,项目名称:annihilate-it,代码行数:13,


示例27: GetResourcesDir

// returns e.g. "/Applications/appname.app/Contents/Resources" if application is bundled,// or the directory of the binary, e.g. "/usr/local/bin/appname", if it is *not* bundled.static wxString GetResourcesDir(){    CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());    CFURLRef absoluteURL = CFURLCopyAbsoluteURL(resourcesURL); // relative -> absolute    CFRelease(resourcesURL);    CFStringRef cfStrPath = CFURLCopyFileSystemPath(absoluteURL,kCFURLPOSIXPathStyle);    CFRelease(absoluteURL);    #if wxCHECK_VERSION(3, 0, 0)      return wxCFStringRef(cfStrPath).AsString(wxLocale::GetSystemEncoding());    #else      return wxMacCFStringHolder(cfStrPath).AsString(wxLocale::GetSystemEncoding());    #endif}
开发者ID:stahta01,项目名称:codeblocks_console,代码行数:15,


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


示例29: setWorkdir

void setWorkdir(){#ifdef __APPLE__    CFBundleRef mainBundle = CFBundleGetMainBundle();    CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);    char path[PATH_MAX];    if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))    {        throw TetrisException("Could not initialize workdir.");    }    CFRelease(resourcesURL);	    chdir(path);#endif}
开发者ID:KarolStola,项目名称:Tetris,代码行数:14,


示例30: CFBundleCopyResourcesDirectoryURL

void OSystem_IPHONE::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {	// Get URL of the Resource directory of the .app bundle	CFURLRef fileUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());	if (fileUrl) {		// Try to convert the URL to an absolute path		UInt8 buf[MAXPATHLEN];		if (CFURLGetFileSystemRepresentation(fileUrl, true, buf, sizeof(buf))) {			// Success: Add it to the search path			Common::String bundlePath((const char *)buf);			s.add("__OSX_BUNDLE__", new Common::FSDirectory(bundlePath), priority);		}		CFRelease(fileUrl);	}}
开发者ID:AReim1982,项目名称:scummvm,代码行数:14,



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


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