当前位置: 首页>>代码示例>>C++>>正文


C++ FSRefMakePath函数代码示例

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


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

示例1: OpenDocumentsAE

static pascal OSErr OpenDocumentsAE( const AppleEvent * theAppleEvent,
	AppleEvent * reply, SInt32 handlerRefcon) {
    AEDescList  docList;
    FSRef       theFSRef;
    long        index;
    long        count = 0;
    OSErr       err;
    char	buffer[2048];

 fprintf( logfile, "OPEN event received.\n" ); fflush( logfile );
    if ( localsplash )
	start_splash_screen();

    err = AEGetParamDesc(theAppleEvent, keyDirectObject,
                         typeAEList, &docList);
    err = AECountItems(&docList, &count);
    for(index = 1; index <= count; index++) {
        err = AEGetNthPtr(&docList, index, typeFSRef,
                        NULL, NULL, &theFSRef,
                        sizeof(theFSRef), NULL);// 4
	err = FSRefMakePath(&theFSRef,(unsigned char *) buffer,sizeof(buffer));
	ViewPostScriptFont(buffer,0);
 fprintf( logfile, " file: %s\n", buffer );
    }
    system( "DYLD_LIBRARY_PATH=\"\"; osascript -e 'tell application \"X11\" to activate'" );
    AEDisposeDesc(&docList);
 fprintf( logfile, " event processed %d.\n", err ); fflush( logfile );

return( err );
}
开发者ID:nthung82,项目名称:fontforge,代码行数:30,代码来源:startui.c

示例2: PathForFolderType

static void PathForFolderType( char dir[PATH_MAX], OSType folderType )
{
	FSRef fs;

	if( FSFindFolder(kUserDomain, folderType, kDontCreateFolder, &fs) )
		FAIL_M( ssprintf("FSFindFolder(%lu) failed.", folderType) );
	if( FSRefMakePath(&fs, (UInt8 *)dir, PATH_MAX) )
		FAIL_M( "FSRefMakePath() failed." );
}
开发者ID:Ancaro,项目名称:stepmania,代码行数:9,代码来源:ArchHooks_MacOSX.cpp

示例3: FSRefToLLString

static void FSRefToLLString(FSRef *fsRef, std::string &llString)
{
	OSStatus	error = noErr;
	char		path[MAX_PATH];
	
	error = FSRefMakePath(fsRef, (UInt8*) path, sizeof(path));
	if (error == noErr)
		llString = path;
}
开发者ID:AGoodPerson,项目名称:Ascent,代码行数:9,代码来源:lldir_mac.cpp

示例4: manually_locate_product

static int manually_locate_product(const char *name, char *buf, size_t bufsize, const char *title)
{
    NavDialogCreationOptions dlgopt;
    NavDialogRef dlg;
    NavReplyRecord reply;
    NavUserAction action;
    AEKeyword keyword;
    AEDesc desc;
    FSRef fsref;
    OSStatus rc;
    int retval = 0;
    const char *promptfmt = _("We can't find your \"%s\" installation."
                            " Would you like to show us where it is?");
    char *promptstr = alloca(strlen(name) + strlen(promptfmt) + 1);

    if (promptstr == NULL)
    {
        log_fatal(_("Out of memory."));
        return(0);
    } /* if */
    sprintf(promptstr, promptfmt, name);

    if (!ui_prompt_yn(promptstr, title))
        return(0);

    NavGetDefaultDialogCreationOptions(&dlgopt);
    dlgopt.optionFlags |= kNavSupportPackages;
    dlgopt.optionFlags |= kNavAllowOpenPackages;
    dlgopt.optionFlags &= ~kNavAllowMultipleFiles;
    dlgopt.windowTitle = CFSTR("Please select the product's icon and click 'OK'.");  /* !!! FIXME! */
    dlgopt.actionButtonLabel = CFSTR("OK");
    NavCreateChooseFolderDialog(&dlgopt, NULL, NULL, NULL, &dlg);
    NavDialogRun(dlg);
    action = NavDialogGetUserAction(dlg);
    if (action != kNavUserActionCancel)
    {
        NavDialogGetReply(dlg, &reply);
        rc = AEGetNthDesc(&reply.selection, 1, typeFSRef, &keyword, &desc);
        if (rc != noErr)
            log_fatal("Unexpected error in AEGetNthDesc: %d", (int) rc);
        else
        {
            /* !!! FIXME: Check return values here! */
            BlockMoveData(*desc.dataHandle, &fsref, sizeof (fsref));
            FSRefMakePath(&fsref, BAD_CAST buf, bufsize - 1);
            buf[bufsize - 1] = '\0';
            AEDisposeDesc(&desc);
            retval = 1;
        } /* if */

        NavDisposeReply(&reply);
    } /* else */

    NavDialogDispose(dlg);

    return(retval);
} /* manually_locate_product */
开发者ID:megastep,项目名称:loki_setup,代码行数:57,代码来源:appbundle.c

示例5: resolve_alias

/* resolve_alias
   -------------
   Resolves the Macintosh alias file at the path pointed to
   by path and stores the resolved path in resolved_path.

   The return value is a  pointer to the resolved path upon
   success.  On  error the  return  value is  zero and both
   errno and mac_errno should be consulted.
*/
char* resolve_alias (const char *path, char *resolved_path)
{
#ifdef HAVE_CORESERVICES
   FSRef *fspath;
   Boolean isdir = 0, isalias = 0;
#endif

#ifndef HAVE_CORESERVICES
   /* this function is for resolving macintosh aliases.
      if we don't have the CoreServices API it's impossible,
      so why fool ourselves, let's just return error now
      and save the cpu cycles for something else */

   errno = EIO; /* returning a generic I/O error */
   return 0;
#endif

   /* reset it for each occurrence */
   /* mac_errno = 0; */

   if (!path) return 0;

   /* if the second parameter is null, assume caller wants it allocated */
   if (!resolved_path) {
      resolved_path = (char *)malloc(PATH_MAX + 1);
      if (!resolved_path) return 0;
   }

#ifdef HAVE_CORESERVICES

   /* allocate memory for the resolved path(s) */
   fspath = (FSRef *)malloc(sizeof(FSRef));

   /* attempt to convert the target path into an FSRef */
   mac_errno = FSPathMakeRef(path, fspath, 0);
   if (mac_errno) return 0;

   /* check if the file is actually an alias */
   mac_errno = FSIsAliasFile(fspath, &isalias, &isdir);
   if (mac_errno) return 0;

   /* resolve the path completely */
   mac_errno = FSResolveAliasFile(fspath, true, &isdir, &isalias);
   if (mac_errno) return 0;

   /* obtain the resolved path */
   mac_errno = FSRefMakePath(fspath, resolved_path, PATH_MAX);
   if (mac_errno) return 0;

#endif

   /* return the resolved path upon success */
   return resolved_path;
}
开发者ID:asvitkine,项目名称:phxd,代码行数:63,代码来源:alias.c

示例6: memset

OSStatus	LLFilePicker::doNavChooseDialog(ELoadFilter filter)
{
	OSStatus		error = noErr;
	NavDialogRef	navRef = NULL;
	NavReplyRecord	navReply;

	memset(&navReply, 0, sizeof(navReply));
	
	// NOTE: we are passing the address of a local variable here.  
	//   This is fine, because the object this call creates will exist for less than the lifetime of this function.
	//   (It is destroyed by NavDialogDispose() below.)
	error = NavCreateChooseFileDialog(&mNavOptions, NULL, NULL, NULL, navOpenFilterProc, (void*)(&filter), &navRef);

	gViewerWindow->mWindow->beforeDialog();

	if (error == noErr)
		error = NavDialogRun(navRef);

	gViewerWindow->mWindow->afterDialog();

	if (error == noErr)
		error = NavDialogGetReply(navRef, &navReply);

	if (navRef)
		NavDialogDispose(navRef);

	if (error == noErr && navReply.validRecord)
	{
		SInt32	count = 0;
		SInt32	index;
		
		// AE indexes are 1 based...
		error = AECountItems(&navReply.selection, &count);
		for (index = 1; index <= count; index++)
		{
			FSRef		fsRef;
			AEKeyword	theAEKeyword;
			DescType	typeCode;
			Size		actualSize = 0;
			char		path[MAX_PATH];	/*Flawfinder: ignore*/
			
			memset(&fsRef, 0, sizeof(fsRef));
			error = AEGetNthPtr(&navReply.selection, index, typeFSRef, &theAEKeyword, &typeCode, &fsRef, sizeof(fsRef), &actualSize);
			
			if (error == noErr)
				error = FSRefMakePath(&fsRef, (UInt8*) path, sizeof(path));
			
			if (error == noErr)
				mFiles.push_back(std::string(path));
		}
	}
	
	return error;
}
开发者ID:Boy,项目名称:rainbow,代码行数:54,代码来源:llfilepicker.cpp

示例7: OpenEventHandler

pascal OSStatus OpenEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData)
{
	NavDialogRef fileDialog;
	NavDialogCreationOptions fo;
	NavGetDefaultDialogCreationOptions(&fo);
	fo.optionFlags=0;
	fo.parentWindow=win;
	NavCreateChooseFileDialog(&fo,NULL,NULL,NULL,NULL,NULL,&fileDialog);
// if someone wants to somehow get the file selector to filter like in the Windows example, that'd be nice ;)
	if (!NavDialogRun(fileDialog)) {
		NavReplyRecord r;
		if (!NavDialogGetReply(fileDialog,&r)) {
			AEKeyword k;
			FSRef fr;
			if (!AEGetNthPtr(&r.selection,1,typeFSRef,&k,NULL,&fr,sizeof(fr),NULL)) {
				char file[256];
				FSRefMakePath(&fr,(BYTE*)file,sizeof(file));
				BASS_StreamFree(chan); // free old stream before opening new
				if (!(chan=BASS_StreamCreateFile(FALSE,file,0,0,BASS_SAMPLE_LOOP|BASS_SAMPLE_FLOAT))) {
					SetControlTitleWithCFString(inUserData,CFSTR("click here to open a file..."));
					{
						ControlRef cref=GetControl(11);
						SetControlData(cref,kControlNoPart,kControlStaticTextTextTag,0,"");
						DrawOneControl(cref);
					}
					SetControl32BitMaximum(GetControl(12),0);
					Error("Can't play the file");
				} else {
					CFStringRef cs=CFStringCreateWithCString(0,file,kCFStringEncodingUTF8);
					SetControlTitleWithCFString(inUserData,cs);
					CFRelease(cs);
					{ // display the file type and length
						QWORD bytes=BASS_ChannelGetLength(chan,BASS_POS_BYTE);
						DWORD time=BASS_ChannelBytes2Seconds(chan,bytes);
						BASS_CHANNELINFO info;
						BASS_ChannelGetInfo(chan,&info);
						sprintf(file,"channel type = %x (%s)\nlength = %llu (%u:%02u)",
							info.ctype,GetCTypeString(info.ctype,info.plugin),bytes,time/60,time%60);
						{
							ControlRef cref=GetControl(11);
							SetControlData(cref,kControlNoPart,kControlStaticTextTextTag,strlen(file),file);
							DrawOneControl(cref);
						}
						SetControl32BitMaximum(GetControl(12),time); // update scroller range
					}
					BASS_ChannelPlay(chan,FALSE);
				}
			}
			NavDisposeReply(&r);
		}
	}
	NavDialogDispose(fileDialog);
    return noErr;
}
开发者ID:bagnz0r,项目名称:ichigo-audio,代码行数:54,代码来源:plugins.c

示例8: RTDECL

RTDECL(int) RTPathUserDocuments(char *pszPath, size_t cchPath)
{
    /*
     * Validate input
     */
    AssertPtrReturn(pszPath, VERR_INVALID_POINTER);
    AssertReturn(cchPath, VERR_INVALID_PARAMETER);

    /*
     * Try NSSystemDirectories first since that works for directories that doesn't exist.
     */
    int rc = VERR_PATH_NOT_FOUND;
    NSSearchPathEnumerationState EnmState = NSStartSearchPathEnumeration(NSDocumentDirectory, NSUserDomainMask);
    if (EnmState != 0)
    {
        char szTmp[PATH_MAX];
        szTmp[0] = szTmp[PATH_MAX - 1] = '\0';
        EnmState = NSGetNextSearchPathEnumeration(EnmState, szTmp);
        if (EnmState != 0)
        {
            size_t cchTmp = strlen(szTmp);
            if (cchTmp >= cchPath)
                return VERR_BUFFER_OVERFLOW;

            if (szTmp[0] == '~' && szTmp[1] == '/')
            {
                /* Expand tilde. */
                rc = RTPathUserHome(pszPath, cchPath - cchTmp + 2);
                if (RT_FAILURE(rc))
                    return rc;
                rc = RTPathAppend(pszPath, cchPath, &szTmp[2]);
            }
            else
                rc = RTStrCopy(pszPath, cchPath, szTmp);
            return rc;
        }
    }

#ifdef IPRT_USE_CORE_SERVICE_FOR_USER_DOCUMENTS
    /*
     * Fall back on FSFindFolder in case the above should fail...
     */
    FSRef ref;
    OSErr err = FSFindFolder(kOnAppropriateDisk, kDocumentsFolderType, false /* createFolder */, &ref);
    if (err == noErr)
    {
        err = FSRefMakePath(&ref, (UInt8*)pszPath, cchPath);
        if (err == noErr)
            return VINF_SUCCESS;
    }
#endif
    Assert(RT_FAILURE_NP(rc));
    return rc;
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:54,代码来源:RTPathUserDocuments-darwin.cpp

示例9: CFSTR

OSErr CScreensaver::GetpathToBOINCManagerApp(char* path, int maxLen)
{
    CFStringRef bundleID = CFSTR("edu.berkeley.boinc");
    OSType creator = 'BNC!';
    FSRef theFSRef;
    OSStatus status = noErr;

    status = LSFindApplicationForInfo(creator, bundleID, NULL, &theFSRef, NULL);
    if (status == noErr)
        status = FSRefMakePath(&theFSRef, (unsigned char *)path, maxLen);
    return status;
}
开发者ID:DanAurea,项目名称:boinc,代码行数:12,代码来源:mac_saver_module.cpp

示例10: GetMacFolder

static std::string GetMacFolder(OSType folderType, const char* errorMsg) {
	std::string ret;
	FSRef ref;
    char path[PATH_MAX];
    OSStatus err = FSFindFolder( kUserDomain, folderType, kCreateFolder, &ref );
	if (err != noErr) {
		throw std::runtime_error(errorMsg);
	}
    FSRefMakePath( &ref, (UInt8*)&path, PATH_MAX );
	ret = path;
	return ret;
}
开发者ID:sago007,项目名称:PlatformFolders,代码行数:12,代码来源:platform_folders.cpp

示例11: NPClientEndOpenROMImage

static bool8 NPClientEndOpenROMImage(void)
{
	OSStatus		err;
	FSCatalogInfo   info;
	FSRef			cartRef;
	char			filename[PATH_MAX + 1];
	bool8			r;

	r = NavEndOpenROMImageSheet(&cartRef);
	if (!r)
	{
		cartOpen = false;
		return (false);
	}

	err = FSGetCatalogInfo(&cartRef, kFSCatInfoVolume, &info, nil, nil, nil);
	lockedROMMedia = IsLockedMedia(info.volume);

	Settings.ForceLoROM          = (romDetect        == kLoROMForce       );
	Settings.ForceHiROM          = (romDetect        == kHiROMForce       );
	Settings.ForceNotInterleaved = (interleaveDetect == kNoInterleaveForce);
	Settings.ForceInterleaved    = (interleaveDetect == kInterleaveForce  );
	Settings.ForceInterleaved2   = (interleaveDetect == kInterleave2Force );
	Settings.ForceInterleaveGD24 = (interleaveDetect == kInterleaveGD24   );
	Settings.ForcePAL            = (videoDetect      == kPALForce         );
	Settings.ForceNTSC           = (videoDetect      == kNTSCForce        );
	Settings.ForceHeader         = (headerDetect     == kHeaderForce      );
	Settings.ForceNoHeader       = (headerDetect     == kNoHeaderForce    );

	Settings.ForceSuperFX = Settings.ForceNoSuperFX = false;
	Settings.ForceDSP1    = Settings.ForceNoDSP1    = false;
	Settings.ForceSA1     = Settings.ForceNoSA1     = false;
	Settings.ForceC4      = Settings.ForceNoC4      = false;
	Settings.ForceSDD1    = Settings.ForceNoSDD1    = false;

	GFX.InfoString = nil;
	GFX.InfoStringTimeout = 0;

	err = FSRefMakePath(&cartRef, (unsigned char *) filename, PATH_MAX);

	if (Memory.LoadROM(filename) /*&& (Memory.ROMCRC32 == nprominfo.crc32)*/)
	{
		ChangeTypeAndCreator(filename, 'CART', '~9X~');
		SNES9X_InitSound();
		cartOpen = true;
		return (true);
	}
	else
	{
		cartOpen = false;
		return (false);
	}
}
开发者ID:alesegdia,项目名称:snes-sdk,代码行数:53,代码来源:mac-client.cpp

示例12: getAppDataPath

bool getAppDataPath(const std::string &appName, std::string &appDataPath) {
   FSRef ref;
   FSFindFolder(kUserDomain, kApplicationSupportFolderType, kCreateFolder, &ref);

   char path[PATH_MAX];
   FSRefMakePath(&ref, (UInt8*)&path, PATH_MAX);

   appDataPath = std::string(path);
   appDataPath += "/" + appName;

   return true;
}
开发者ID:aaronmjacobs,项目名称:Shiny,代码行数:12,代码来源:OSUtils.cpp

示例13: GetProcessBundleLocation

char *get_exename(char *buf, size_t size)
{
    ProcessSerialNumber PSN;
    FSRef ref;

    if (GetCurrentProcess(&PSN) < 0 ||
        GetProcessBundleLocation(&PSN, &ref) < 0 ||
        FSRefMakePath(&ref, buf, size) < 0)
        return NULL;

    return buf;
}
开发者ID:Ismael-VC,项目名称:femtolisp,代码行数:12,代码来源:dirpath.c

示例14: FSRefMakePath

RString CrashHandler::GetLogsDirectory()
{
	FSRef fs;
	char dir[PATH_MAX];
	
	if( FSFindFolder(kUserDomain, kDomainLibraryFolderType, kDontCreateFolder, &fs) ||
	    FSRefMakePath(&fs, (UInt8 *)dir, PATH_MAX) )
	{
		return "/tmp";
	}
	return RString( dir ) + "/Logs/" PRODUCT_ID;
}
开发者ID:Ancaro,项目名称:stepmania,代码行数:12,代码来源:Crash.cpp

示例15: gui_unique_mac_open_documents

/* Handle the kAEOpenDocuments Apple events. This will register
 * an idle source callback for each filename in the event.
 */
static pascal OSErr
gui_unique_mac_open_documents (const AppleEvent *inAppleEvent,
                               AppleEvent       *outAppleEvent,
                               long              handlerRefcon)
{
  OSStatus    status;
  AEDescList  documents;
  gchar       path[MAXPATHLEN];

  status = AEGetParamDesc (inAppleEvent,
                           keyDirectObject, typeAEList,
                           &documents);
  if (status == noErr)
    {
      long count = 0;
      int  i;

      AECountItems (&documents, &count);

      for (i = 0; i < count; i++)
        {
          FSRef    ref;
          gchar    *callback_path;
          GSource  *source;
          GClosure *closure;

          status = AEGetNthPtr (&documents, i + 1, typeFSRef,
                                0, 0, &ref, sizeof (ref),
                                0);
          if (status != noErr)
            continue;

          FSRefMakePath (&ref, (UInt8 *) path, MAXPATHLEN);

          callback_path = g_strdup (path);

          closure = g_cclosure_new (G_CALLBACK (gui_unique_mac_idle_open),
                                    (gpointer) callback_path,
                                    (GClosureNotify) g_free);

          g_object_watch_closure (G_OBJECT (unique_gimp), closure);

          source = g_idle_source_new ();
          g_source_set_priority (source, G_PRIORITY_LOW);
          g_source_set_closure (source, closure);
          g_source_attach (source, NULL);
          g_source_unref (source);
        }
    }

    return status;
}
开发者ID:AnonPower,项目名称:picman,代码行数:55,代码来源:gui-unique.c


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