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


C++ FSpMakeFSRef函数代码示例

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


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

示例1: LoadBundle

CFBundleRef LoadBundle(const char *tpath)
{
	OSErr theErr;
	CFBundleRef theBundle = NULL;
	FSSpec fspec;
	if ((theErr = MCS_path2FSSpec(tpath, &fspec)) != noErr)
		return NULL;
	FSRef theRef;
	CFURLRef theBundleURL;
	theErr = FSpMakeFSRef(&fspec, &theRef);
	theBundleURL = CFURLCreateFromFSRef(kCFAllocatorSystemDefault, &theRef);
	if (theBundleURL != NULL)
	{
		/* Turn the CFURL into a bundle reference */
		theBundle = CFBundleCreate(kCFAllocatorSystemDefault, theBundleURL);
		CFRelease(theBundleURL);
	}
	if (theErr != noErr || theBundle == NULL)
		return NULL;
	Boolean isLoaded = CFBundleLoadExecutable(theBundle);
	if (!isLoaded)
	{
		CFRelease(theBundle);
		return NULL;
	}
	return theBundle;
}
开发者ID:Bjoernke,项目名称:livecode,代码行数:27,代码来源:osxstack.cpp

示例2: mkstr255

void *file_list1st(const char *dir, FLINFO *fli) {

	FLISTH		ret;
	Str255		fname;
	FSSpec		fss;
	FSRef		fsr;
	FSIterator	fsi;

	mkstr255(fname, dir);
	if ((FSMakeFSSpec(0, 0, fname, &fss) != noErr) ||
		(FSpMakeFSRef(&fss, &fsr) != noErr) ||
		(FSOpenIterator(&fsr, kFSIterateFlat, &fsi) != noErr)) {
		goto ff1_err1;
	}
	ret = _MALLOC(sizeof(_FLHDL), dir);
	if (ret == NULL) {
		goto ff1_err2;
	}
	((FLHDL)ret)->eoff = FALSE;
	((FLHDL)ret)->fsi = fsi;
	if (file_listnext(ret, fli) == SUCCESS) {
		return(ret);
	}

ff1_err2:
	FSCloseIterator(fsi);

ff1_err1:
	return(NULL);
}
开发者ID:FREEWING-JP,项目名称:np2pi,代码行数:30,代码来源:dosio.cpp

示例3: FSSpecToFullPath

void	FSSpecToFullPath(const FSSpec &fss, char *path)
{
	FSRef ref;
	
	RequireNoErrString(FSpMakeFSRef(&fss, &ref), "FSpMakeFSRef failed");
	RequireNoErrString(FSRefMakePath(&ref, (UInt8 *)path, 256), "FSRefMakePath failed");
}
开发者ID:fruitsamples,项目名称:XFramework,代码行数:7,代码来源:XUtility.cpp

示例4: FT_ATSFontGetFileReference

  /* Mac OS X 10.5 and later.                                  */
  static OSStatus
  FT_ATSFontGetFileReference( ATSFontRef  ats_font_id,
                              FSRef*      ats_font_ref )
  {
#if defined( MAC_OS_X_VERSION_10_5 ) && \
    ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 )
 
    OSStatus  err;

    err = ATSFontGetFileReference( ats_font_id, ats_font_ref );

    return err;
#elif __LP64__ /* No 64bit Carbon API on legacy platforms */
    FT_UNUSED( ats_font_id );
    FT_UNUSED( ats_font_ref );


    return fnfErr;
#else /* 32bit Carbon API on legacy platforms */
    OSStatus  err;
    FSSpec    spec;


    err = ATSFontGetFileSpecification( ats_font_id, &spec );
    if ( noErr == err )
      err = FSpMakeFSRef( &spec, ats_font_ref );

    return err;
#endif
  }
开发者ID:32767,项目名称:libgdx,代码行数:31,代码来源:ftmac.c

示例5: string

 string& Configuration::GetExecutablePath() {
     string& path = new string("");
     ProcessSerialNumber PSN;
     ProcessInfoRec pinfo;
     FSSpec pspec;
     FSRef fsr;
     OSStatus err;
     // set up process serial number.
     PSN.highLongOfPSN = 0;
     PSN.lowLongOfPSN = kCurrentProcess;
     // set up info block.
     pinfo.processInfoLength = sizeof(pinfo);
     pinfo.processName = NULL;
     pinfo.processAppSpec = &pspec;
     // grab the vrefnum and directory.
     err = GetProcessInformation(&PSN, &pinfo);
     if (! err ) {
         char c_path[2048];
         FSSpec fss2;
         int tocopy;
         err = FSMakeFSSpec(pspec.vRefNum, pspec.parID, 0, &fss2);
         if ( ! err ) {
             err = FSpMakeFSRef(&fss2, &fsr);
             if ( ! err ) {
                 char c_path[2049];
                 err = (OSErr)FSRefMakePath(&fsr, (UInt8*)c_path, 2048);
                 if (! err ) {
                     path += c_path;
                 }
             }
         }
     }
     return path;
 }
开发者ID:dwhobrey,项目名称:MindCausalModellingLibrary,代码行数:34,代码来源:Configuration.cpp

示例6: file_attr

short file_attr(const char *path) {

	Str255			fname;
	FSSpec			fss;
	FSRef			fsr;
	FSCatalogInfo	fsci;
	short			ret;

	mkstr255(fname, path);
	if ((FSMakeFSSpec(0, 0, fname, &fss) != noErr) ||
		(FSpMakeFSRef(&fss, &fsr) != noErr) ||
		(FSGetCatalogInfo(&fsr, kFSCatInfoNodeFlags, &fsci,
										NULL, NULL, NULL) != noErr)) {
		return(-1);
	}
	if (fsci.nodeFlags & kFSNodeIsDirectoryMask) {
		ret = FILEATTR_DIRECTORY;
	}
	else {
		ret = FILEATTR_ARCHIVE;
	}
	if (fsci.nodeFlags & kFSNodeLockedMask) {
		ret |= FILEATTR_READONLY;
	}
	return(ret);
}
开发者ID:FREEWING-JP,项目名称:np2pi,代码行数:26,代码来源:dosio.cpp

示例7: FFAvi_MovieImportFile

ComponentResult FFAvi_MovieImportFile(ff_global_ptr storage, const FSSpec *theFile, Movie theMovie, Track targetTrack,
									  Track *usedTrack, TimeValue atTime, TimeValue *addedDuration, long inFlags, long *outFlags)
{
	ComponentResult result;
	Handle dataRef = NULL;
	OSType dataRefType;
	FSRef theFileFSRef;
	
	*outFlags = 0;
	
	result = QTNewDataReferenceFromFSSpec(theFile, 0, &dataRef, &dataRefType);
	require_noerr(result,bail);
	
	result = MovieImportDataRef(storage->ci, dataRef, dataRefType, theMovie, targetTrack, usedTrack, atTime, addedDuration,
								inFlags, outFlags);
	require_noerr(result, bail);
	
	result = FSpMakeFSRef(theFile, &theFileFSRef);
	require_noerr(result, bail);
		
bail:
		if(dataRef)
			DisposeHandle(dataRef);
	
	return result;
} /* FFAvi_MovieImportFile() */
开发者ID:eirnym,项目名称:perian,代码行数:26,代码来源:ff_MovieImport.c

示例8: FT_New_Face_From_FSSpec

  FT_New_Face_From_FSSpec( FT_Library     library,
                           const FSSpec*  spec,
                           FT_Long        face_index,
                           FT_Face*       aface )
  {
#if ( __LP64__ ) || ( defined( MAC_OS_X_VERSION_10_5 ) && \
      ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) )
    FT_UNUSED( library );
    FT_UNUSED( spec );
    FT_UNUSED( face_index );
    FT_UNUSED( aface );

    return FT_THROW( Unimplemented_Feature );
#else
    FSRef  ref;


    /* check of `library' and `aface' delayed to `FT_New_Face_From_FSRef' */

    if ( !spec || FSpMakeFSRef( spec, &ref ) != noErr )
      return FT_THROW( Invalid_Argument );
    else
      return FT_New_Face_From_FSRef( library, &ref, face_index, aface );
#endif
  }
开发者ID:ImageMagick,项目名称:ttf,代码行数:25,代码来源:ftmac.c

示例9: ExtractSingleItem

/* This function extracts a single FSRef from a NavReplyRecord. */
static OSErr ExtractSingleItem(const NavReplyRecord *reply, FSRef *item)
{
    FSSpec fss;
    SInt32 itemCount;
    DescType junkType;
    AEKeyword junkKeyword;
    Size junkSize;
    OSErr osErr;

    osErr = AECountItems(&reply->selection, &itemCount);
    if( itemCount != 1 )	/* we only work with one object at a time */
        osErr = paramErr;
    if( osErr == noErr )
        osErr = AEGetNthPtr(&reply->selection, 1, typeFSS, &junkKeyword, &junkType, &fss, sizeof(fss), &junkSize);
    if( osErr == noErr )
    {
        mycheck(junkType == typeFSS);
        mycheck(junkSize == sizeof(FSSpec));

        /* We call FSMakeFSSpec because sometimes Nav is braindead		*/
        /* and gives us an invalid FSSpec (where the name is empty).	*/
        /* While FSpMakeFSRef seems to handle that (and the file system	*/
        /* engineers assure me that that will keep working (at least	*/
        /* on traditional Mac OS) because of the potential for breaking	*/
        /* existing applications), I'm still wary of doing this so		*/
        /* I regularise the FSSpec by feeding it through FSMakeFSSpec.	*/

        if( fss.name[0] == 0 )
            osErr = FSMakeFSSpec(fss.vRefNum, fss.parID, fss.name, &fss);
        if( osErr == noErr )
            osErr = FSpMakeFSRef(&fss, item);
    }

    return osErr;
}
开发者ID:fruitsamples,项目名称:FSCopyObject,代码行数:36,代码来源:HelloWorld.c

示例10: strcpyFileSystemRepresentationFromClassicPath

static OSStatus strcpyFileSystemRepresentationFromClassicPath(char *nativePath, char * classicPath, long nativePathMaxLength )
{
		CFURLRef   fileAsCFURLRef = 0;
		Boolean    resolveAgainstBase = true;
		FSRef fileAsFSRef;
		Boolean gotPath;
		char pathPStr[256];
		FSSpec spec;
		OSStatus err = 0;
		
		strcpy(pathPStr,classicPath);
		my_c2pstr(pathPStr);
		err = FSMakeFSSpec(0, 0, (StringPtr)pathPStr,&spec);
		if(err == fnfErr) {
			// just means the file does not exist yet
			err = FSpCreate (&spec,'MPW ','TEXT',smSystemScript); // we should be able to use any creator and type here
		}
		if(err) return err;
		
		err = FSpMakeFSRef(&spec,&fileAsFSRef);
		if(err) return err;

		 // Convert the reference to the file to a CFURL
		fileAsCFURLRef = CFURLCreateFromFSRef(NULL, &fileAsFSRef);
		if(fileAsCFURLRef) {
			gotPath = CFURLGetFileSystemRepresentation(fileAsCFURLRef,resolveAgainstBase,(UInt8 *)nativePath,nativePathMaxLength);
			CFRelease(fileAsCFURLRef); fileAsCFURLRef = 0;
		}
		
		if(gotPath) 
			return noErr;
		
		return -1; // did not get the path

}
开发者ID:JamesMakela-NOAA,项目名称:PyGnome,代码行数:35,代码来源:CarbonUtil.cpp

示例11: spec2path

static OSStatus spec2path(const FSSpec& spec, char* path, UInt32 maxPathSize)
{
    FSRef ref;
    OSStatus status = FSpMakeFSRef(&spec, &ref);
    if (status == noErr)
        status = ref2path(ref, path, maxPathSize);
    return status;
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:8,代码来源:MRJSession.cpp

示例12: PathToFile

/* FSSpec -> FSRef -> URL(Unix) -> HPFS+ */
int PathToFile(char *pathName, int pathNameMax, FSSpec *where,UInt32 encoding) {        
        CFURLRef sillyThing;
        CFStringRef filePath;
        FSSpec	failureRetry;
        FSRef	theFSRef;
        OSErr	error;
        Boolean isDirectory=false,retryWithDirectory=false;
        char	rememberName[256];
        
        *pathName = 0x00;
        error = FSpMakeFSRef (where, &theFSRef);
        if (error != noErr) {
            retryWithDirectory = true;
            failureRetry = *where;
            CopyCStringToPascal(":",failureRetry.name);
            CopyPascalStringToC(where->name,(char *) &rememberName);
            error = FSpMakeFSRef(&failureRetry,&theFSRef);
            if (error != noErr) 
                return -1;
	}
        
        sillyThing =  CFURLCreateFromFSRef (kCFAllocatorDefault, &theFSRef);
        isDirectory = CFURLHasDirectoryPath(sillyThing);
        
        filePath = CFURLCopyFileSystemPath (sillyThing, kCFURLHFSPathStyle);
        CFRelease(sillyThing);
        
  		CFMutableStringRef mutableStr= CFStringCreateMutableCopy(NULL, 0, filePath);
          CFRelease(filePath);
  
  		// HFS+ imposes Unicode2.1 decomposed UTF-8 encoding on all path elements
  		if (gCurrentVMEncoding == kCFStringEncodingUTF8) 
  			CFStringNormalize(mutableStr, kCFStringNormalizationFormKC); // pre-combined
  
          CFStringGetCString (mutableStr, pathName,pathNameMax, encoding);
        
        if (retryWithDirectory) {
            strcat(pathName,":");
            strcat(pathName,rememberName);
            isDirectory = false;
        }
        if (isDirectory)
            strcat(pathName,":");
        return 0;
}
开发者ID:fniephaus,项目名称:squeak,代码行数:46,代码来源:sqMacFileLogic.c

示例13: wxMacFSSpec2MacFilename

wxString wxMacFSSpec2MacFilename( const FSSpec *spec )
{
    FSRef fsRef ;
    if ( FSpMakeFSRef( spec , &fsRef) == noErr )
    {
        return wxMacFSRefToPath( &fsRef ) ;
    }
    return wxEmptyString ;
}
开发者ID:mheinsen,项目名称:wxWidgets,代码行数:9,代码来源:filefn.cpp

示例14: FolderIconCheck

/* フォルダアイコンをチェック */
OSErr FolderIconCheck(const FSSpec *theFolderSpec,short *alertMode)
{
	OSErr	err;
	long	dirID;
	FSSpec	theIconFile;
	Str15	iconFileName;
	Boolean	isDirectory;
	#ifdef __MOREFILESX__
	FSRef	fsRef;
	FinderInfo	info;
	
	err = FSpMakeFSRef(theFolderSpec,&fsRef);
	if (err != noErr) return err;
	#else
	DInfo	dirInfo;
	#endif
	
	/* まず、カスタムアイコンフラグが立っているかどうかを調べる */
	/* ここでエラーが発生する場合はおそらくフォルダアイコン編集も不可能なのでそのまま返る */
	#ifdef __MOREFILESX__
	err = FSGetFinderInfo(&fsRef,&info,NULL,NULL);
	#else
	err=FSpGetDInfo(theFolderSpec,&dirInfo);
	#endif
	if (err!=noErr) return err;
	
	/* カスタムアイコンフラグが立っていなければ問題なし */
	#ifdef __MOREFILESX__
	if ((info.folder.finderFlags & kHasCustomIcon) == 0) return noErr;
	#else
	if ((dirInfo.frFlags & kHasCustomIcon) == 0) return noErr;
	#endif
	
	/* 立っている場合は、カスタムアイコンをチェック */
	#ifdef __MOREFILESX__
	err = FSGetNodeID(&fsRef,&dirID,&isDirectory);
	#else
	err=FSpGetDirectoryID(theFolderSpec,&dirID,&isDirectory);
	#endif
	if (err!=noErr) return err;
	
	GetIndString(iconFileName,140,3);
	err=FSMakeFSSpec(theFolderSpec->vRefNum,dirID,iconFileName,&theIconFile);
	if (err==fnfErr) /* アイコンファイルが見つからない場合は、フラグが間違っているわけだから修正 */
	{
		#ifdef __MOREFILESX__
		err = FSClearHasCustomIcon(&fsRef);
		#else
		err=FSpClearHasCustomIcon(theFolderSpec);
		#endif
		return noErr;
	}
	else if (err!=noErr) /* それ以外のエラーなら編集できないだろうから戻る */
		return err;
	
	return FileIconCheck(&theIconFile,alertMode);
}
开发者ID:amatubu,项目名称:iconparty,代码行数:58,代码来源:IPIconSupport.c

示例15: FT_New_Face_From_FSSpec

  FT_New_Face_From_FSSpec( FT_Library     library,
                           const FSSpec*  spec,
                           FT_Long        face_index,
                           FT_Face*       aface )
  {

#if HAVE_FSREF

    FSRef  ref;


    if ( !spec || FSpMakeFSRef( spec, &ref ) != noErr )
      return FT_THROW( Invalid_Argument );
    else
      return FT_New_Face_From_FSRef( library, &ref, face_index, aface );

#elif HAVE_FSSPEC

    FT_Error      error;
    FT_Open_Args  args;
    OSErr         err;
    UInt8         pathname[PATH_MAX];


    if ( !spec )
      return FT_THROW( Invalid_Argument );

    err = FT_FSpMakePath( spec, pathname, sizeof ( pathname ) );
    if ( err )
      error = FT_ERR( Cannot_Open_Resource );

    error = FT_New_Face_From_Resource( library, pathname, face_index, aface );
    if ( error || *aface )
      return error;

    /* fallback to datafork font */
    args.flags    = FT_OPEN_PATHNAME;
    args.pathname = (char*)pathname;
    return FT_Open_Face( library, &args, face_index, aface );

#else

    FT_UNUSED( library );
    FT_UNUSED( spec );
    FT_UNUSED( face_index );
    FT_UNUSED( aface );

    return FT_THROW( Unimplemented_Feature );

#endif /* HAVE_FSREF, HAVE_FSSPEC */

  }
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:52,代码来源:ftmac.c


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