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


C++ FSGetCatalogInfo函数代码示例

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


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

示例1: makeFSSpec

OSErr makeFSSpec(char *pathString, int pathStringLength,FSSpec *spec)
{	
    CFURLRef    sillyThing;
    CFStringRef tmpStrRef;
	CFMutableStringRef filePath;
    FSRef	theFSRef;
    OSErr	err;
    
    tmpStrRef = CFStringCreateWithBytes(kCFAllocatorDefault,(UInt8 *) pathString,
										pathStringLength, gCurrentVMEncoding, true);
    if (tmpStrRef == nil)
        return -1000;
	filePath = CFStringCreateMutableCopy(NULL, 0, tmpStrRef);
	if (gCurrentVMEncoding == kCFStringEncodingUTF8) 
		CFStringNormalize(filePath, kCFStringNormalizationFormD);
    sillyThing = CFURLCreateWithFileSystemPath (kCFAllocatorDefault,filePath,kCFURLHFSPathStyle,false);
	if (sillyThing == NULL) 
		return -2000;
		
    if (CFURLGetFSRef(sillyThing,&theFSRef) == false) {
        // name contains multiple aliases or does not exist, so fallback to lookupPath
        CFRelease(filePath);
        CFRelease(sillyThing);
        return lookupPath(pathString,pathStringLength,spec,true,true);
    } 
            
    CFRelease(filePath);
    err = FSGetCatalogInfo (&theFSRef,kFSCatInfoNone,nil,nil,spec,nil);
    CFRelease(sillyThing);
    return err;
}
开发者ID:fniephaus,项目名称:squeak,代码行数:31,代码来源:sqMacFileLogic.c

示例2: nav_file_filter

Boolean nav_file_filter(AEDesc *theItem,void *info,void *callBackUD,NavFilterModes filterMode)
{
    char					*c,filename[256];
    NavFileOrFolderInfo		*filefolder;
    AEDesc					desc;
	HFSUniStr255			uniname;
    CFStringRef				cfstr;
    FSRef					fref;
    
    if ((theItem->descriptorType!=typeFSS) && (theItem->descriptorType!=typeFSRef)) return(FALSE);

    filefolder=(NavFileOrFolderInfo*)info;
    if (filefolder->isFolder) return(TRUE);

	AECoerceDesc(theItem,typeFSRef,&desc);
	AEGetDescData(&desc,(void*)&fref,sizeof(FSRef));
    AEDisposeDesc(&desc);

    FSGetCatalogInfo(&fref,kFSCatInfoNone,NULL,&uniname,NULL,NULL);
	cfstr=CFStringCreateWithCharacters(kCFAllocatorDefault,uniname.unicode,uniname.length);
	CFStringGetCString(cfstr,filename,256,kCFStringEncodingMacRoman);
    CFRelease(cfstr);
    
    c=strchr(filename,'.');
    if (c==NULL) return(FALSE);
    
    return(strcasecmp((c+1),nav_filetype)==0);
}
开发者ID:prophile,项目名称:dim3,代码行数:28,代码来源:nav_serve.c

示例3: GetAttachmentIconOpBitmap

OpBitmap* GetAttachmentIconOpBitmap(const uni_char* filename, BOOL big_attachment_icon, int iSize)
{
	int 		cx, cy;
	OpBitmap* 	result = 0;
	SInt16		label;
	IconRef		iconRef;

	FSRef fsref;
	if(OpFileUtils::ConvertUniPathToFSRef(filename, fsref))
	{
		FSCatalogInfo 	info;

		if(noErr == FSGetCatalogInfo(&fsref, kIconServicesCatalogInfoMask, &info, NULL, NULL, NULL))
		{
			if(noErr == GetIconRefFromFileInfo(&fsref, 0, NULL, kIconServicesCatalogInfoMask, &info, kIconServicesNormalUsageFlag, &iconRef, &label))
			{
				if (!iSize)
					cx = cy = big_attachment_icon ? 32 : 16;
				else
					cx = cy = iSize;

				result = CreateOpBitmapFromIcon(iconRef, cx, cy);
				ReleaseIconRef(iconRef);
			}
		}
	}

	return result;
}
开发者ID:prestocore,项目名称:browser,代码行数:29,代码来源:MacIcons.cpp

示例4: SetFileComment

int SetFileComment(std::string spath, std::string scomment) {
	const char *path = spath.c_str();
	const char *comment = scomment.c_str();
	OSErr err = noErr;
	FSRef fileRef;
	FSSpec fileSpec;

	// see if the file in question exists and we can write it
	if (access(path, R_OK | W_OK | F_OK) == - 1) {
		return 1;
	}

	// get file reference from path
	err = FSPathMakeRef( (const UInt8 *) path, &fileRef, NULL);
	if (err != noErr) {
		return 1;
	}

	// retrieve filespec from file ref
	err = FSGetCatalogInfo(&fileRef, NULL, NULL, NULL, &fileSpec, NULL);
	if (err != noErr) {
		return 1;
	}
	// being by setting MacOS X Finder Comment
	Str255 pCommentStr;
	CopyCStringToPascal(comment, pCommentStr);
	err = MoreFESetComment(&fileSpec, pCommentStr, NULL);
	if (err != noErr) {
		return 1;
	}
	return 0;
}
开发者ID:r0ssar00,项目名称:platform,代码行数:32,代码来源:osx.cpp

示例5: FT_GetFile_From_Mac_ATS_Name

  FT_GetFile_From_Mac_ATS_Name( const char*  fontName,
                                FSSpec*      pathSpec,
                                FT_Long*     face_index )
  {
#if ( __LP64__ ) || ( defined( MAC_OS_X_VERSION_10_5 ) && \
      ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) )
    FT_UNUSED( fontName );
    FT_UNUSED( pathSpec );
    FT_UNUSED( face_index );

    return FT_Err_Unimplemented_Feature;
#else
    FSRef     ref;
    FT_Error  err;


    err = FT_GetFileRef_From_Mac_ATS_Name( fontName, &ref, face_index );
    if ( FT_Err_Ok != err )
      return err;

    if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone, NULL, NULL,
                                    pathSpec, NULL ) )
      return FT_Err_Unknown_File_Format;

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

示例6: getfsvolume

boolean getfsvolume ( const ptrfilespec fs, long *vnum ) {
	
	//
	// 2006-07-12 creedon: for Mac, FSRef-ized
	//
	// 5.1.5b11 dmb:	get the volume that is actually specified in the fspec.
	//
	//					don't expand partial paths using the default directory.
	//

	#ifdef MACVERSION
	
		FSCatalogInfo catalogInfo;
		OSErr err = FSGetCatalogInfo ( &fs->ref, kFSCatInfoVolume, &catalogInfo, NULL, NULL, NULL );
		
		if ( catalogInfo.volume == 0 )
			return ( false );
		
		*vnum = catalogInfo.volume;

		return ( err == noErr );
		
	#endif
	
	#ifdef WIN95VERSION

		*vnum = 0;
	
		return ( true );
		
	#endif
	
	} // getfsvolume
开发者ID:karstenw,项目名称:frontier,代码行数:33,代码来源:filepath.c

示例7: FSGetCatalogInfo

bool	HLFileSystemObject::IsVolume() const
{
	FSCatalogInfo theCatalogInfo;
	OSStatus theError = FSGetCatalogInfo(&mFSRef, kFSCatInfoNodeFlags | kFSCatInfoNodeID, &theCatalogInfo, NULL, NULL, NULL);
	ThrowIfError(theError, CAException(theError), "HLFileSystemObject::IsVolume: couldn't get the catalog info");
	return ((theCatalogInfo.nodeFlags & kFSNodeIsDirectoryMask) != 0) && (theCatalogInfo.nodeID == fsRtDirID);
}
开发者ID:fruitsamples,项目名称:HAL,代码行数:7,代码来源:HLFileSystemObject.cpp

示例8: MyIsVisibleFile

static OSStatus MyIsVisibleFile(const FSRef *ref, Boolean *visible)
	// Determine whether a ref points to a visible file.
	//
	// I really want to call LSCopyItemInfoForRef and test the resulting 
	// flags for kLSItemInfoIsInvisible and kLSItemInfoIsPlainFile, but 
	// if I do that I have to take a dependency on Launch Services, which 
	// is part of ApplicationServices.framework [3101095].  That's not 
	// acceptable, because this code is commonly used in a setuid root helper 
	// tool and such a tool should depend on the minimal set of services, 
	// so I roll my own visibility test code.
{
	OSStatus		err;
	FSCatalogInfo 	info;
	HFSUniStr255  	name;
	
	assert(ref != NULL);
	assert(visible != NULL);
	
	err = FSGetCatalogInfo(ref, kFSCatInfoNodeFlags | kFSCatInfoFinderInfo, &info, &name, NULL, NULL);
	if (err == noErr) {
		*visible =     ((info.nodeFlags & kFSNodeIsDirectoryMask) == 0) 					// file
					&& ((((FInfo *) &info.finderInfo[0])->fdFlags & kIsInvisible) == 0)		// visible
					&& (name.unicode[0] != '.');											// doesn't begin with .
	}
	return err;
}
开发者ID:fruitsamples,项目名称:MoreSCF,代码行数:26,代码来源:MoreSCFCCLScanner.c

示例9: defined

static PyObject *AE_GetAppTerminology(PyObject* self, PyObject* args)
{
#if defined(__LP64__)
	PyErr_SetString(PyExc_NotImplementedError,
					"aem.ae.getappterminology isn't available in 64-bit processes.");
	return NULL;
#else
	static ComponentInstance defaultComponent;
	FSRef fsRef;
	FSSpec fss;
	AEDesc theDesc;
	Boolean didLaunch;
	OSAError err;
	
	if (!PyArg_ParseTuple(args, "O&", AE_GetFSRef, &fsRef))
		return NULL;
	err = FSGetCatalogInfo(&fsRef, kFSCatInfoNone, NULL, NULL, &fss, NULL);
    if (err != noErr) return AE_MacOSError(err);
	if (!defaultComponent) {
		defaultComponent = OpenDefaultComponent(kOSAComponentType, 'ascr');
		err = GetComponentInstanceError(defaultComponent);
		if (err) return AE_MacOSError(err);
	}
	err = OSAGetAppTerminology(defaultComponent, 
							   kOSAModeNull,
							   &fss, 
							   0, 
							   &didLaunch, 
							   &theDesc);
	if (err) return AE_MacOSError(err);
	return BuildTerminologyList(&theDesc, typeAETE);
#endif
}
开发者ID:AdminCNP,项目名称:appscript,代码行数:33,代码来源:ae.c

示例10: ofToDataPath

void ofxQtAudioRecorder::createMovie(string url, int sampleRate, int numChannels){
	
	OSErr					err = noErr;
	FSRef					fsref;
	Boolean					isdir;
	
	// full data path
	url = ofToDataPath(url, true);
	
	// kill a file and make a new one if needed:	
	FILE * pFile;
	pFile = fopen (url.c_str(),"w");
	fclose (pFile);
	
	// create path reference
	err = FSPathMakeRef((const UInt8*)url.c_str(), &fsref, &isdir);
	if (err) { printf("FSPathMakeRef failed %d\n", err); printf("ERROR creating movie \n"); return; }
	
	// create file spec
	err = FSGetCatalogInfo(&fsref, kFSCatInfoNone, NULL, NULL, &myFileSpec, NULL);
	if (err) { printf("FSGetCatalogInfo failed %d\n", err); printf("ERROR creating movie \n"); return; }
	
	// create that movie file
	err = CreateMovieFile(&myFileSpec, 'TVOD', smCurrentScript, createMovieFileDeleteCurFile | createMovieFileDontCreateResFile, &movieResRefNum, &movie);
	if(err) {
		printf("error: failed to create movie file\n");
		return;
	}
	
	prepareAudioRecording(sampleRate, numChannels);
}
开发者ID:mantissa,项目名称:ofxQtAudioRecorder,代码行数:31,代码来源:ofxQtAudioRecorder.cpp

示例11: 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

示例12: FSPathMakeRef

void QStorageInfoPrivate::retrieveLabel()
{
#if !defined(Q_OS_IOS)
	// deprecated since 10.8
	FSRef ref;
	FSPathMakeRef(reinterpret_cast<const UInt8*>(QFile::encodeName(rootPath).constData()),
	              &ref,
	              Q_NULLPTR);
	// deprecated since 10.8
	FSCatalogInfo catalogInfo;
	OSErr error;
	error = FSGetCatalogInfo(&ref, kFSCatInfoVolume, &catalogInfo, Q_NULLPTR, Q_NULLPTR, Q_NULLPTR);

	if (error != noErr)
	{
		return;
	}

	// deprecated (use CFURLCopyResourcePropertiesForKeys for 10.7 and higher)
	HFSUniStr255 volumeName;
	error = FSGetVolumeInfo(catalogInfo.volume,
	                        0,
	                        Q_NULLPTR,
	                        kFSVolInfoFSInfo,
	                        Q_NULLPTR,
	                        &volumeName,
	                        Q_NULLPTR);

	if (error == noErr)
	{
		name = QCFString(FSCreateStringFromHFSUniStr(Q_NULLPTR, &volumeName));
	}

#endif
}
开发者ID:sunpeng196,项目名称:CuteTorrent,代码行数:35,代码来源:qstorageinfo_mac.cpp

示例13: fixmacfile

void fixmacfile(char *filename)
{
  FInfo  fndrinfo;
#ifdef OSX_CARBON
  FSSpec fileSpec;
  FSRef fileRef;

  FSPathMakeRef((unsigned char *)filename, &fileRef, NULL);
  FSGetCatalogInfo(&fileRef, kFSCatInfoNone, NULL, NULL, &fileSpec, NULL);
  FSpGetFInfo(&fileSpec, &fndrinfo);
  fndrinfo.fdType='TEXT';
  fndrinfo.fdCreator='MSWD';
  FSpSetFInfo(&fileSpec, &fndrinfo);

#else
  char filename1[FNMLNGTH];
  char filename2[FNMLNGTH];
  strcpy(filename1,filename);
  strcpy(filename2,filename);
  getfinfo(filename1,0,&fndrinfo);
  fndrinfo.fdType='TEXT';
  fndrinfo.fdCreator='MSWD';
  setfinfo(filename2,0,&fndrinfo);
#endif
}
开发者ID:NadiaUQAM,项目名称:super_trees_with_consense,代码行数:25,代码来源:macface.c

示例14: Initialize

    void Initialize(const std::string& location) {
	path_ = CFStringCreateWithCString(kCFAllocatorDefault, location.c_str(), kCFStringEncodingUTF8);
	if(!path_) {
	    std::cout << "KotoeriImpl: CFStringCreateCopy() failed" << std::endl;
	    return;
	}

	FSSpec spec;
	FSRef fileRef;
	CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path_, kCFURLPOSIXPathStyle, false);
	OSErr err = !noErr;
	if(CFURLGetFSRef(url, &fileRef)) {
	    err = FSGetCatalogInfo(&fileRef, kFSCatInfoNone, NULL, NULL, &spec, NULL);
	}
	if(url) CFRelease(url);
	if(err != noErr) {
	    return;
	}

	if(DCMGetDictionaryIDFromFile(&spec, &id_) != noErr) {
	    std::cout << "DCMGetDictionaryIDFromFile() failed" << std::endl;
	    if(DCMRegisterDictionaryFile(&spec, &id_) != noErr) {
		std::cout << "DCMRegisterDictionaryFile() failed" << std::endl;
		return;
	    }
	    isRegistered_ = true;
	}
    }
开发者ID:0xBADDCAFE,项目名称:aquaskk,代码行数:28,代码来源:MacKotoeriDictionary.cpp

示例15: FSGetCatalogInfo

bool	HLDirectoryFactory::ObjectIsA(const FSRef& inFSRef) const
{
	FSCatalogInfo theCatalogInfo;
	OSStatus theError = FSGetCatalogInfo(&inFSRef, kFSCatInfoNodeFlags, &theCatalogInfo, NULL, NULL, NULL);
	ThrowIfError(theError, CAException(theError), "HLDirectoryFactory::ObjectIsA: couldn't get the catalog info");
	return (theCatalogInfo.nodeFlags & kFSNodeIsDirectoryMask) != 0;
}
开发者ID:fruitsamples,项目名称:HAL,代码行数:7,代码来源:HLDirectory.cpp


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