本文整理汇总了C++中FSGetCatalogInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ FSGetCatalogInfo函数的具体用法?C++ FSGetCatalogInfo怎么用?C++ FSGetCatalogInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FSGetCatalogInfo函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: PrintOSXComment
static void PrintOSXComment (char *path)
{
OSErr err = noErr;
FSRef fileRef;
FSSpec fileSpec;
Str255 comment = "\p";
char cStrCmt[255] = "\0";
AEIdleUPP inIdleProc = NewAEIdleUPP(&MyAEIdleCallback);
///////////// Make sure we can do as we please :) /////////////
//see if the file in question exists and we can write it
if (access(path, R_OK|F_OK) == -1)
{
perror(path);
return;
}
//get file reference from path
err = FSPathMakeRef(path, &fileRef, NULL);
if (err != noErr)
{
fprintf(stderr, "FSPathMakeRef: Error %d for file %s\n", err, path);
return;
}
//retrieve filespec from file ref
err = FSGetCatalogInfo (&fileRef, NULL, NULL, NULL, &fileSpec, NULL);
if (err != noErr)
{
fprintf(stderr, "FSGetCatalogInfo(): Error %d getting file spec for %s\n", err, path);
return;
}
///////////// oK, now we can go about getting the comment /////////////
// call the apple event routine. I'm not going to pretend I understand what's going on
// in all those horribly kludgy functions, but at least it works.
err = MoreFEGetComment(&fileRef, &fileSpec, comment, inIdleProc);
if (err)
{
fprintf(stderr, "Error %d getting comment for '%s'\n", err, path);
if (err == -600)
fprintf(stderr, "Finder is not running\n", err);//requires Finder to be running
return;
}
//convert pascal string to c string
strncpy((char *)&cStrCmt, (unsigned char *)&comment+1, comment[0]);
//if there is no comment, we don't print out anything
if (!strlen((char *)&cStrCmt))
return;
//print out the comment
if (!printFileName)
printf("%s\n", (char *)&cStrCmt);
else
printf("Comment for '%s':\n%s\n", path, (char *)&cStrCmt);
}
开发者ID:specious,项目名称:osxutils,代码行数:59,代码来源:main.c
示例17: wxMacFilename2FSSpec
void wxMacFilename2FSSpec( const wxString& path , FSSpec *spec )
{
OSStatus err = noErr;
FSRef fsRef;
wxMacPathToFSRef( path , &fsRef );
err = FSGetCatalogInfo(&fsRef, kFSCatInfoNone, NULL, NULL, spec, NULL);
verify_noerr( err );
}
开发者ID:mheinsen,项目名称:wxWidgets,代码行数:8,代码来源:filefn.cpp
示例18: qt_mac_create_fsspec
// Don't use this function, it won't work in 10.5 (Leopard) and up
OSErr qt_mac_create_fsspec(const QString &file, FSSpec *spec)
{
FSRef fsref;
OSErr ret = qt_mac_create_fsref(file, &fsref);
if (ret == noErr)
ret = FSGetCatalogInfo(&fsref, kFSCatInfoNone, 0, 0, spec, 0);
return ret;
}
开发者ID:maxxant,项目名称:qt,代码行数:9,代码来源:qcore_mac.cpp
示例19: createMovieFromPath
bool createMovieFromPath(char * path, Movie &movie){
Boolean isdir = false;
OSErr result = 0;
FSSpec theFSSpec;
short actualResId = DoTheRightThing;
#ifdef TARGET_WIN32
result = NativePathNameToFSSpec (path, &theFSSpec, 0);
if (result != noErr) {
ofLog(OF_LOG_ERROR,"NativePathNameToFSSpec failed %d", result);
ofLog(OF_LOG_ERROR,"Error loading movie");
return false;
}
#endif
#ifdef TARGET_OSX
FSRef fsref;
result = FSPathMakeRef((const UInt8*)path, &fsref, &isdir);
if (result) {
ofLog(OF_LOG_ERROR,"FSPathMakeRef failed %d", result);
ofLog(OF_LOG_ERROR,"Error loading movie");
return false;
}
result = FSGetCatalogInfo(&fsref, kFSCatInfoNone, NULL, NULL, &theFSSpec, NULL);
if (result) {
ofLog(OF_LOG_ERROR,"FSGetCatalogInfo failed %d", result);
ofLog(OF_LOG_ERROR,"Error loading movie");
return false;
}
#endif
short movieResFile;
result = OpenMovieFile (&theFSSpec, &movieResFile, fsRdPerm);
if (result == noErr) {
short movieResID = 0;
result = NewMovieFromFile(&movie, movieResFile, &movieResID, (unsigned char *) 0, newMovieActive, (Boolean *) 0);
if (result == noErr){
CloseMovieFile (movieResFile);
} else {
ofLog(OF_LOG_ERROR,"NewMovieFromFile failed %d", result);
return false;
}
} else {
ofLog(OF_LOG_ERROR,"OpenMovieFile failed %d", result);
return false;
}
return true;
}
开发者ID:alejandroflores,项目名称:openFrameworks,代码行数:58,代码来源:ofVideoPlayer.cpp
示例20: getFInfoViaFSRef
OSErr getFInfoViaFSRef(FSRef *theFSRef, FInfo *finderInfo) {
OSErr err;
FSCatalogInfo catInfo;
err = FSGetCatalogInfo (theFSRef,kFSCatInfoFinderInfo,&catInfo,nil,nil,nil);
memcpy(finderInfo,&catInfo.finderInfo,sizeof(FInfo));
return err;
}
开发者ID:Geal,项目名称:Squeak-VM,代码行数:9,代码来源:sqMacUnixFileInterface.c
注:本文中的FSGetCatalogInfo函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论