• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FSMakeFSSpec函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SetBasePath

void SetBasePath(void)
{
	OSErr			error;
	FSSpec		where;
	//Handle		theString;
	Str255		name;
	short			vRef;
	long			dirID;
	long			nDirID;
	error = FindFolder(kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder, &vRef, &dirID);
	GetIndString(name, kTransportPath, 1);
	if (name[0] != '0') {
		error = FSMakeFSSpec(vRef, dirID, name, &where);	// First, check to see if the directory exists
		if (error != noErr) {
			// Create it
			error = FSpDirCreate(&where, smSystemScript, &nDirID);
		}
		p2cstr(name);
		strncat((char *)name, "Serial", 63);	// It won't matter if this exists or not; we'll get the parent directory ID this way
		c2pstr((char *)name);
		error = FSMakeFSSpec(vRef, dirID, name, &where);
		gvRef = where.vRefNum;
		gparID = where.parID;
	}
}
开发者ID:jleclanche,项目名称:darkdust-ctp2,代码行数:25,代码来源:loadtransport.c


示例2: file_attr

short file_attr(const char *path) {

#ifdef TARGET_API_MAC_CARBON
	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);
#else
	Str255		fname;
	FSSpec		fss;
	CInfoPBRec	pb;
	short		ret;

	mkstr255(fname, path);
	FSMakeFSSpec(0, 0, fname, &fss);
	pb.dirInfo.ioNamePtr = fss.name;
	pb.dirInfo.ioVRefNum = fss.vRefNum;
	pb.dirInfo.ioDrDirID = fss.parID;
	if (fss.name[0] == 0) {
		pb.dirInfo.ioFDirIndex = -1;
	}
	else {
		pb.dirInfo.ioFDirIndex = 0;
	}
	if (PBGetCatInfo(&pb, false) != noErr) {
		return(-1);
	}
	if (pb.hFileInfo.ioFlAttrib & ioDirMask) {
		ret = FILEATTR_DIRECTORY;
	}
	else {
		ret = FILEATTR_ARCHIVE;
	}
	if (pb.hFileInfo.ioFlAttrib & 0x01) {
		ret |= FILEATTR_READONLY;
	}
	return(ret);
#endif
}
开发者ID:FREEWING-JP,项目名称:np2pi,代码行数:58,代码来源:dosio.cpp


示例3: CleanTemp

void CleanTemp(void)
{
    OSErr   err = noErr;
    short   vRefNum;
    long    dirID;
    FSSpec  viewerFSp;
    XPISpec *xpiList, *currXPI = 0, *nextXPI = 0;
#ifdef MIW_DEBUG
    Boolean isDir = false;
#endif
    
#ifndef MIW_DEBUG
    /* get "viewer" in "Temporary Items" folder */
    ERR_CHECK(FindFolder(kOnSystemDisk, kTemporaryFolderType, kCreateFolder, &vRefNum, &dirID));
    err = FSMakeFSSpec(vRefNum, dirID, kViewerFolder, &viewerFSp);
#else
    /* for DEBUG builds temp is "<currProcessVolume>:Temp NSInstall:" */
    ERR_CHECK(GetCWD(&dirID, &vRefNum));
 	err = FSMakeFSSpec(vRefNum, 0, kTempFolder, &viewerFSp);
	if (err == fnfErr)
	    return; /* no debug temp exists */
	err = FSpGetDirectoryID(&viewerFSp, &dirID, &isDir);
	if (err != noErr || !isDir)
	    return;
    err = FSMakeFSSpec(vRefNum, dirID, kViewerFolder, &viewerFSp);
#endif
    
    /* whack the viewer folder if it exists */
    if (err == noErr)
    {
        ERR_CHECK(DeleteDirectory(viewerFSp.vRefNum, viewerFSp.parID, viewerFSp.name));
    }
    
    /* clean out the zippies (.xpi's) */
    xpiList = (XPISpec *) NewPtrClear(sizeof(XPISpec));
    if (!xpiList)
        return;
    IterateDirectory(vRefNum, dirID, "\p", 1, CheckIfXPI, (void*)&xpiList);
    
    if (xpiList)
    {
        currXPI = xpiList;
        while(currXPI)
        {
            nextXPI = currXPI->next; /* save nextXPI before we blow away currXPI */
            if (currXPI->FSp)
            {
                FSpDelete(currXPI->FSp);
                DisposePtr((Ptr)currXPI->FSp);
            }
            DisposePtr((Ptr)currXPI);
            currXPI = nextXPI;
        }
    }
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:55,代码来源:MacInstallWizard.c


示例4: FSMakeFSSpecFromPath

/* This function is an adaptation of the function FSpLocationFromPath in
   tclMacUtils.c in the Tcl 8.0 distribution */
OSErr FSMakeFSSpecFromPath(ConstStr255Param fileName, FSSpecPtr spec)
{
  Boolean isDir, wasAlias;
  int pos, end;
  OSErr err;
  Str255 Name;
  short vRefNum;
  long dirID;
  
  /* get the initial directory information and set up first path component */
  CopyNamePart(Name, fileName, 1);
  if (Name[0] < fileName[0] && Name[1] != ':') { /* absolute path */
    Name[0]++;
    Name[Name[0]] = ':';
    if ((err = FSMakeFSSpec(0, 0, Name, spec)) != noErr)
      return err;
    if ((err = FSpGetDirectoryID(spec, &dirID, &isDir)) != noErr)
      return err;
    if (! isDir)
      return dirNFErr;
    vRefNum = spec->vRefNum;
    pos = Name[0] + 1;
    CopyNamePart(Name, fileName, pos);
  }
  else {
    dirID = 0;
    vRefNum = 0;
    pos = 1;
    isDir = true;
  }
  
  /* process remaining path parts */
  end = fileName[0] + 1;
  while (true) {
    if ((err = FSMakeFSSpec(vRefNum, dirID, Name[0] == 0 ? NULL : Name,
                            spec)) != noErr ||
        (err = ResolveAliasFile(spec, true, &isDir, &wasAlias)) != noErr)
      return err;
    pos += Name[0];
    if (pos < end) {
      if ((err = FSpGetDirectoryID(spec, &dirID, &isDir)) != noErr)
        return err;
      if (! isDir)
        return dirNFErr;
      vRefNum = spec->vRefNum;
      CopyNamePart(Name, fileName, pos);
    }
    else
      return noErr;
  }
}
开发者ID:jhbadger,项目名称:xlispstat,代码行数:53,代码来源:macutils.c


示例5: FSMakeFSSpecCompat

pascal	OSErr	FSMakeFSSpecCompat(short vRefNum,
                                   long dirID,
                                   ConstStr255Param fileName,
                                   FSSpec *spec)
{
    OSErr	result;

#if !__MACOSSEVENORLATER
    if ( !FSHasFSSpecCalls() && !QTHasFSSpecCalls() )
    {
        Boolean	isDirectory;

        result = GetObjectLocation(vRefNum, dirID, fileName,
                                   &(spec->vRefNum), &(spec->parID), spec->name,
                                   &isDirectory);
    }
    else
#endif	/* !__MACOSSEVENORLATER */
    {
        /* Let the file system create the FSSpec if it can since it does the job */
        /* much more efficiently than I can. */
        result = FSMakeFSSpec(vRefNum, dirID, fileName, spec);

        /* Fix a bug in Macintosh PC Exchange's MakeFSSpec code where 0 is */
        /* returned in the parID field when making an FSSpec to the volume's */
        /* root directory by passing a full pathname in MakeFSSpec's */
        /* fileName parameter. Fixed in Mac OS 8.1 */
        if ( (result == noErr) && (spec->parID == 0) )
            spec->parID = fsRtParID;
    }
    return ( result );
}
开发者ID:zv,项目名称:metamage_1,代码行数:32,代码来源:FSpCompat.c


示例6: preloadTransport

/*----------------------------------------------------------------------
 Called internally to load a code fragment.
----------------------------------------------------------------------*/
OSErr preloadTransport(StringPtr transportName, CFragConnectionID* connID)
{
	OSErr anErr;
	FSSpec spec;
	Ptr mainAddr;
	Str255 errName;
	Str255 fragName;
	CFragSymbolClass symClass;

	//	we need to setup our function pointers for the selected
	//	transport. We do this by looking for a file with a code
	//	fragment and then we load all of the function pointers
	//	from it for later use throughout the application

	//	create a pascal string which is the file name which has the
	//	fragment in it

	anErr = FSMakeFSSpec(gvRef, gparID, transportName, &spec);
	if (anErr == noErr) {

		anErr = GetDiskFragment(
			&spec,
			0,
			kCFragGoesToEOF,
			fragName,
			kLoadCFrag,
			connID,
			&mainAddr,
			errName
		);

	}
	return anErr;
}
开发者ID:jleclanche,项目名称:darkdust-ctp2,代码行数:37,代码来源:loadtransport.c


示例7: __PHYSFS_platformIsSymLink

int __PHYSFS_platformIsSymLink(const char *fname)
{
    OSErr err;
    FSSpec spec;
    Boolean a = 0;
    Boolean f = 0;
    CInfoPBRec infoPB;
    char *ptr;
    char *dir = alloca(strlen(fname) + 1);
    BAIL_IF_MACRO(dir == NULL, ERR_OUT_OF_MEMORY, 0);
    strcpy(dir, fname);
    ptr = strrchr(dir, ':');
    if (ptr == NULL)  /* just a volume name? Can't be a symlink. */
        return(0);

    /* resolve aliases up to the actual file... */
    *ptr = '\0';
    BAIL_IF_MACRO(fnameToFSSpec(dir, &spec) != noErr, NULL, 0);

    *ptr = strlen(ptr + 1);  /* ptr is now a pascal string. Yikes! */
    memset(&infoPB, '\0', sizeof (CInfoPBRec));
    infoPB.dirInfo.ioNamePtr = spec.name;
    infoPB.dirInfo.ioVRefNum = spec.vRefNum;
    infoPB.dirInfo.ioDrDirID = spec.parID;
    infoPB.dirInfo.ioFDirIndex = 0;
    BAIL_IF_MACRO(oserr(PBGetCatInfoSync(&infoPB)) != noErr, NULL, 0);

    err = FSMakeFSSpec(spec.vRefNum, infoPB.dirInfo.ioDrDirID,
                       (const unsigned char *) ptr, &spec);
    BAIL_IF_MACRO(oserr(err) != noErr, NULL, 0);
    BAIL_IF_MACRO(oserr(IsAliasFile(&spec, &a, &f)) != noErr, NULL, 0);
    return(a);
} /* __PHYSFS_platformIsSymlink */
开发者ID:newerthcom,项目名称:savagerebirth,代码行数:33,代码来源:macclassic.c


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


示例9: LoadXPIStub

/*-------------------------------------------------------------------
 *   XPI Stub Load/Unload
 *-------------------------------------------------------------------*/
OSErr
LoadXPIStub(XPI_InitProc* pfnInit, XPI_InstallProc* pfnInstall, XPI_ExitProc* pfnExit, 
			CFragConnectionID* connID, FSSpec& aTargetDir, Str255 errName)
{
	OSErr				err;
	FSSpec				fslib;
	Str63 				fragName = XPISTUB_DLL;
	Ptr					mainAddr, symAddr;
	CFragSymbolClass	symClass;
	long				tgtDirID;
	Boolean 			isDir;
	
	err = FSpGetDirectoryID( &aTargetDir, &tgtDirID, &isDir );
	if (err!=noErr)
		return err;
	else if (!isDir)
		return paramErr;
		
	err = FSMakeFSSpec(aTargetDir.vRefNum, tgtDirID, fragName, &fslib);
	if (err!=noErr)
		return err;
		
	err = GetDiskFragment(&fslib, 0, kCFragGoesToEOF, nil, /*kPrivateCFragCopy*/kReferenceCFrag, connID, &mainAddr, errName);
										   
	if ( err == noErr && *connID != NULL)
	{
		ERR_CHECK_RET( FindSymbol(*connID, "\pXPI_Init", &symAddr, &symClass), err );
		*pfnInit = (XPI_InitProc) symAddr;
		
		ERR_CHECK_RET( FindSymbol(*connID, "\pXPI_Install", &symAddr, &symClass), err);
		*pfnInstall = (XPI_InstallProc) symAddr;
		
		ERR_CHECK_RET( FindSymbol(*connID, "\pXPI_Exit", &symAddr, &symClass), err);
		*pfnExit = (XPI_ExitProc) symAddr;
	}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:38,代码来源:XPInstallGlue.c


示例10: SaveDriverState

/*__________________________________________________________________________*/
Boolean SaveDriverState (short refnum, StringPtr file, OSType creator, OSType type)
{
	FSSpec spec; OSErr err; TDriverInfos dInfos;
	long size, dirID; short vrefNum, ref;
	Ptr ptr;
	
	if (FindMidiShareFolder (true, &vrefNum, &dirID) != noErr) return false;
	if (!MidiGetDriverInfos (refnum, &dInfos)) return false;

	size = Get1DriverStateSize (dInfos.slots);
	if (!size) return true;
	
	ptr = NewPtrSys(size);
	if (!ptr) return false;
		
	Get1DriverState (refnum, dInfos.slots, ptr, size);
	err = FSMakeFSSpec(vrefNum, dirID, file, &spec);
	if (err == fnfErr)
		err = FSpCreate (&spec, creator, type, smSystemScript);
	if (err != noErr) goto err;
		err = FSpOpenDF (&spec, fsWrPerm, &ref);
	if (err != noErr) goto err;
		err = FSWrite (ref, &size, ptr);
	FSClose (ref);
	DisposePtr (ptr);
	return err == noErr;

err:
	DisposePtr (ptr);
	return false;
}
开发者ID:AntonLanghoff,项目名称:whitecatlib,代码行数:32,代码来源:SavingState.c


示例11: vr_findVerRegName

extern char* vr_findVerRegName()
{
    FSSpec  regSpec;
    OSErr   err;
    short   foundVRefNum;
    long    foundDirID;
    int     bCreate = 0;
    
    /* quick exit if we have the info */
    if ( verRegName != NULL )
        return verRegName;

    err = FindFolder(kOnSystemDisk,'pref', false, &foundVRefNum, &foundDirID);

    if (err == noErr)
    {
        err = FSMakeFSSpec(foundVRefNum, foundDirID, MAC_VERREG, &regSpec);

        if (err == -43) /* if file doesn't exist */
        {
            err = FSpCreate(&regSpec, 'MOSS', 'REGS', smSystemScript);
            bCreate = 1;
        }

        if (err == noErr)
        {
            Handle thePath;
            short pathLen;
            err = FSpGetFullPath(&regSpec, &pathLen, &thePath);
            if (err == noErr && thePath)
            {
                /* we have no idea if this moves memory, so better lock the handle */
             #if defined(STANDALONE_REGISTRY) || defined(USE_STDIO_MODES)
                HLock(thePath);
                verRegName = (char *)XP_ALLOC(pathLen + 1);
                XP_STRNCPY(verRegName, *thePath, pathLen);
                verRegName[pathLen] = '\0';
            #else
                /* Since we're now using NSPR, this HAS to be a unix path! */
                const char* src;
                char* dst;
                HLock(thePath);
                verRegName = (char*)XP_ALLOC(pathLen + 2);
                src = *(char**)thePath;
                dst = verRegName;
                *dst++ = '/';
                while (pathLen--)
                {
                    char c = *src++;
                    *dst++ = (c == ':') ? '/' : c;
                }
                *dst = '\0';
            #endif
            }
            DisposeHandle(thePath);
        }
    }

    return verRegName;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:60,代码来源:vr_stubs.c


示例12: GetSharedLibraryFilterProc

static pascal void
GetSharedLibraryFilterProc(const CInfoPBRec* const inCpb, Boolean* inWantQuit, void *inFilterData)
{
	GetSharedLibraryFilterProcData* pFilterData = (GetSharedLibraryFilterProcData*) inFilterData;

	if ((inCpb->hFileInfo.ioFlAttrib & (1 << ioDirFlg)) == 0)
	{
		FSSpec	fragSpec;
		OSErr	tempErr;
		Str255	errName;
		Boolean	crap;
		UInt32	codeOffset;
		UInt32	codeLength;
		
		// it's a file
		
		// ¥ fix-me do we really want to allow all 'APPL's' for in which to find this library?
		switch (inCpb->hFileInfo.ioFlFndrInfo.fdType)
		{
			case kCFragLibraryFileType:
			case 'APPL':
				tempErr = FSMakeFSSpec(inCpb->hFileInfo.ioVRefNum, inCpb->hFileInfo.ioFlParID, inCpb->hFileInfo.ioNamePtr, &fragSpec);

				// this shouldn't fail
				if (noErr != tempErr)
				{
					return;
				}
				
				// resolve an alias if this was one
				tempErr = ResolveAliasFile(&fragSpec, true, &crap, &crap);

				// if got here we have a shlb (or app-like shlb)
				if (noErr != tempErr)
				{
					// probably couldn't resolve an alias
					return;
				}
		
				break;
			default:
				return;
		}
	
		// see if this symbol is in this fragment
		if (LibInPefContainer(&fragSpec, pFilterData->inName, &codeOffset, &codeLength))
			tempErr = GetDiskFragment(&fragSpec, codeOffset, codeLength, fragSpec.name, kLoadCFrag, &pFilterData->outID, &pFilterData->outAddress, errName);
		else
			return;
				
		// stop if we found a library by that name
		if (noErr == tempErr)
		{			
			*inWantQuit = true;
			pFilterData->outFound = true;
			pFilterData->outError = tempErr;
		}
	}
	// FSpIterateDirectory will automagically call us for subsequent sub-dirs if necessary
}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:60,代码来源:macdll.c


示例13: opendir

DIR *
opendir (const char *name)           /* Open a directory stream on NAME. */
/* Return a DIR stream on the directory, or NULL if it could not be opened.  */
{
	CInfoPBRec cat_info;
	FSSpec spec;
	Boolean targetIsFolder, wasAliased;

	if (indx) {											// We don't support more than one dir open at a time
		closedir((DIR *)1);								// Fail hard
		return((DIR *)0);
		}
	dir_volume=0;										// Default to the application directory
	dir_ID=0;
	while (name[0]=='.') ++name;						// Don't allow leading '.', avoids device names
		CToPCpy(fname,name);
		if (!FSMakeFSSpec(0,0,fname,&spec)) {			// Figure out where user is pointing
			ResolveAliasFile(&spec, true, &targetIsFolder, &wasAliased);
			cat_info.dirInfo.ioCompletion=(IOCompletionUPP)0;
			cat_info.dirInfo.ioNamePtr=spec.name;
			cat_info.dirInfo.ioVRefNum=spec.vRefNum;
			cat_info.dirInfo.ioFDirIndex = 0;			// Use full spec
			cat_info.dirInfo.ioDrDirID=spec.parID;
			cat_info.dirInfo.ioFVersNum=0;
			if (!PBGetCatInfoSync(&cat_info) && (cat_info.dirInfo.ioFlAttrib&16)) 
				spec.parID=cat_info.dirInfo.ioDrDirID;	// Found it, save it's volume and dirID
			dir_volume=spec.vRefNum;
			dir_ID=spec.parID;
			}
		else return ((DIR *)0);
	indx=1;
	return((DIR *)1);
	}
开发者ID:AMDmi3,项目名称:analog,代码行数:33,代码来源:macstuff.c


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


示例15: getCurrentResourceFSSpec

// --------------------------------------------------------------------------------------
static OSErr getCurrentResourceFSSpec(FSSpec *curResSpec)
{
	OSErr error;
	FCBPBPtr fileInfo;		// file control block parameter block pointer
	StrFileName fileName;
	
		/* In the age of application packages and bundles, it's less likely that the 
		   current resource file is the application file itself.  It's more likely to be 
		   a flattened resource file in a bundle so we need a generic method instead of 
		   the traditional Process Manager method of getting the current application's 
		   FSSpec of it's executable file */
	fileInfo = (FCBPBPtr)NewPtr(sizeof(FCBPBRec));
	
	fileInfo->ioNamePtr = fileName;		// to hold the resource file's name
	fileInfo->ioVRefNum = 0;			// 0 to search through all open files on all volumes
	fileInfo->ioRefNum = CurResFile();	// get info about the main resource file 
										// by using its reference number
	fileInfo->ioFCBIndx = 0;			// 0 to ignore this parameter and use the 
										// ioRefNum parameter instead
	
	error = PBGetFCBInfoSync(fileInfo);	// synchronous because we don't have 
						// anything else to do while we're waiting on the filesystem
	
	if (error == noErr)		// if we got the necessary file info, make an FSSpec out of it
		FSMakeFSSpec(fileInfo->ioFCBVRefNum, fileInfo->ioFCBParID, fileName, curResSpec);
						
	DisposePtr((Ptr)fileInfo);
	
	return error;
}
开发者ID:fruitsamples,项目名称:CarbonPorting,代码行数:31,代码来源:IconListUtilities.c


示例16: InitializeQTExporters

void _HYPlatformGraphicPane::_SavePicture	(_String prompt)
{
	InitializeQTExporters  ();
	if (graphicsFormats.lLength)
	{
		_String filePath;
		long 	menuChoice = SaveFileWithPopUp (filePath,
											      savePicPrompt,prompt,savePicAs,graphicsFormats);
	
		if (menuChoice>=0)
		{
			ComponentInstance grexc = OpenComponent ((Component)qtGrexComponents(menuChoice));
			GraphicsExportSetInputGWorld (grexc,thePane);
			FSSpec  fs;
			Str255	buff;
			StringToStr255 (filePath,buff);
			FSMakeFSSpec(0,0,buff,&fs);
			GraphicsExportSetOutputFile (grexc,&fs);
			GraphicsExportRequestSettings (grexc,nil,nil); 		
			unsigned long dummy;
			OSType t,c;		
			GraphicsExportGetDefaultFileTypeAndCreator (grexc,&t,&c);                           
			GraphicsExportSetOutputFileTypeAndCreator (grexc,t,c);
			GraphicsExportDoExport (grexc,&dummy);			
            CloseComponent (grexc);
        }
    }
}				
开发者ID:mdsmith,项目名称:OCLHYPHY,代码行数:28,代码来源:HYPlatformGraphicPane.cpp


示例17: FindPrefs

OSErr	FindPrefs(FSSpec* where)
{
	OSErr		error = noErr;
	Str255	theString;
	Str255	name;
	FSSpec	spec;
	short		foundVRefNum;
	long		foundDirID;
	// Look for the prefs in the folder
	GetIndString(theString, kTransportPath, 1);
	p2cstr(theString);
	strncpy(name, theString, 63);
	strncat(name, "Modem prefs", 63);
	c2pstr(name);
	error = FindFolder(kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder, &foundVRefNum, &foundDirID);
	if (error == noErr) {
		error = FSMakeFSSpec(foundVRefNum, foundDirID, name, where);
		if (error == fnfErr) {		// May need to create the file
			FSpCreateResFile(where, 'mwNT', 'pref', smSystemScript);
			error = ResError();
		}
	}

	return error;
}
开发者ID:jleclanche,项目名称:darkdust-ctp2,代码行数:25,代码来源:CTBStuff.c


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


示例19: path2fss

//path2fss makes an FSSpec from a path with or without a filename
int path2fss( FSSpec *fss, char *path ) {
    char buf[1024];
    char *p = &buf[1];
    strcpy( p, path );
    buf[0] = strlen( p );
    return ( FSMakeFSSpec( 0, 0, (unsigned char *)buf, fss ) );
  }
开发者ID:Room1337,项目名称:projectM-update,代码行数:8,代码来源:pm.c


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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FSPathMakeRef函数代码示例发布时间:2022-05-30
下一篇:
C++ FSMDEBUG函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap