这篇教程C++ FSRefMakePath函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中FSRefMakePath函数的典型用法代码示例。如果您正苦于以下问题:C++ FSRefMakePath函数的具体用法?C++ FSRefMakePath怎么用?C++ FSRefMakePath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了FSRefMakePath函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: OpenDocumentsAEstatic 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,
示例2: PathForFolderTypestatic 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,
示例3: FSRefToLLStringstatic 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,
示例4: manually_locate_productstatic 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,
示例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,
示例6: memsetOSStatus 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,
示例7: OpenEventHandlerpascal 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,
示例8: RTDECLRTDECL(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,
示例9: CFSTROSErr 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,
示例10: GetMacFolderstatic 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,
示例11: NPClientEndOpenROMImagestatic 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,
示例12: getAppDataPathbool 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,
示例13: GetProcessBundleLocationchar *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,
示例14: FSRefMakePathRString 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,
示例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 OSErrgui_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,
示例16: M_GetSavegamesPathFString M_GetSavegamesPath(){ FString path; char cpath[PATH_MAX]; FSRef folder; if (noErr == FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &folder) && noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX)) { path << cpath << "/" GAME_DIR "/Savegames/"; } return path;}
开发者ID:Marqt,项目名称:ViZDoom,代码行数:13,
示例17: QByteArrayQFontEngine::FaceId QFontEngineMac::faceId() const{ FaceId ret;#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) FSRef ref; if (ATSFontGetFileReference(FMGetATSFontRefFromFont(fontID), &ref) != noErr) return ret; ret.filename = QByteArray(128, 0); ret.index = fontID; FSRefMakePath(&ref, (UInt8 *)ret.filename.data(), ret.filename.size());#else FSSpec spec; if (ATSFontGetFileSpecification(FMGetATSFontRefFromFont(fontID), &spec) != noErr) return ret; FSRef ref; FSpMakeFSRef(&spec, &ref); ret.filename = QByteArray(128, 0); ret.index = fontID; FSRefMakePath(&ref, (UInt8 *)ret.filename.data(), ret.filename.size());#endif return ret;}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:23,
示例18: CFURLCreateFromFSRefCFURLRef CFURLCreateFromFSRef(CFAllocatorRef alloc, FSRef* location){ std::string path; struct stat st; Boolean isDir = false; if (!FSRefMakePath(location, path)) return nullptr; if (::stat(path.c_str(), &st)) isDir = S_ISDIR(st.st_mode); return CFURLCreateFromFileSystemRepresentation(alloc, (const UInt8*) path.c_str(), path.size(), isDir);}
开发者ID:010001111,项目名称:darling,代码行数:14,
示例19: mainint main(int argc, char **argv) { /* Look up the application by its bundle identifier, which is given in the Info.plist file. This will continue to work even if the user changes the name of the application, unlike fullPathForApplication. */ FSRef fsref; OSStatus status; int len; char buf[BUFSIZE]; status = LSFindApplicationForInfo(NULL,CFSTR("edu.upenn.cis.Unison"),NULL,&fsref,NULL); if (status) { if (status == kLSApplicationNotFoundErr) { fprintf(stderr,"Error: can't find the Unison application using the Launch Services database./n"); fprintf(stderr,"Try launching Unison from the Finder, and then try this again./n",status); } else fprintf(stderr,"Error: can't find Unison application (%d)./n",status); exit(1); } status = FSRefMakePath(&fsref,buf,BUFSIZE); if (status) { fprintf(stderr,"Error: problem building path to Unison application (%d)./n",status); exit(1); } len = strlen(buf); if (len + strlen(EXECPATH) + 1 > BUFSIZE) { fprintf(stderr,"Error: path to Unison application exceeds internal buffer size (%d)./n",BUFSIZE); exit(1); } strcat(buf,EXECPATH); /* It's important to pass the absolute path on to the GUI, that's how it knows where to find the bundle, e.g., the Info.plist file. */ argv[0] = buf; // printf("The Unison executable is at %s/n",argv[0]); // printf("Running.../n"); execv(argv[0],argv); /* If we get here the execv has failed; print an error message to stderr */ perror("unison"); exit(1);}
开发者ID:bsingr,项目名称:unison-mirror,代码行数:49,
示例20: FSRefMakePathOSStatus FSRefMakePath(const FSRef* fsref, uint8_t* path, uint32_t maxSize){ std::string rpath; if (!fsref || !path || !maxSize) return paramErr; if (!FSRefMakePath(fsref, rpath)) return fnfErr; strncpy((char*) path, rpath.c_str(), maxSize); path[maxSize-1] = 0; return noErr;}
开发者ID:magicpriest,项目名称:darling-FC-edition,代码行数:15,
示例21: M_GetConfigPathFString M_GetConfigPath(bool for_reading){ char cpath[PATH_MAX]; FSRef folder; if (noErr == FSFindFolder(kUserDomain, kPreferencesFolderType, kCreateFolder, &folder) && noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX)) { FString path; path << cpath << "/" GAMENAMELOWERCASE ".ini"; return path; } // Ungh. return GAMENAMELOWERCASE ".ini";}
开发者ID:Marqt,项目名称:ViZDoom,代码行数:15,
示例22: NPClientEndOpenROMImagestatic bool8 NPClientEndOpenROMImage (void){ OSStatus err; FSRef cartRef; char filename[PATH_MAX + 1]; bool8 r; r = NavEndOpenROMImageSheet(&cartRef); if (!r) { cartOpen = false; return (false); } CheckSaveFolder(&cartRef); Settings.ForceLoROM = (romDetect == kLoROMForce ); Settings.ForceHiROM = (romDetect == kHiROMForce ); Settings.ForceHeader = (headerDetect == kHeaderForce ); Settings.ForceNoHeader = (headerDetect == kNoHeaderForce ); Settings.ForceInterleaved = (interleaveDetect == kInterleaveForce ); Settings.ForceInterleaved2 = (interleaveDetect == kInterleave2Force ); Settings.ForceInterleaveGD24 = (interleaveDetect == kInterleaveGD24 ); Settings.ForceNotInterleaved = (interleaveDetect == kNoInterleaveForce); Settings.ForcePAL = (videoDetect == kPALForce ); Settings.ForceNTSC = (videoDetect == kNTSCForce ); GFX.InfoString = NULL; GFX.InfoStringTimeout = 0; S9xResetSaveTimer(true); err = FSRefMakePath(&cartRef, (unsigned char *) filename, PATH_MAX); SNES9X_InitSound(); if (Memory.LoadROM(filename) /*&& (Memory.ROMCRC32 == nprominfo.crc32)*/) { ChangeTypeAndCreator(filename, 'CART', '~9X~'); cartOpen = true; return (true); } else { cartOpen = false; return (false); }}
开发者ID:RedGuyyyy,项目名称:snes9x,代码行数:48,
示例23: LSFindApplicationForInfostd::stringMoose::applicationPath(){ FSRef appRef; LSFindApplicationForInfo( kLSUnknownCreator, CFSTR( AUDIOSCROBBLER_BUNDLEID ), NULL, &appRef, NULL ); char path[PATH_MAX]; FSRefMakePath( &appRef, (unsigned char*)path, PATH_MAX ); if ( path == NULL ) return "/Applications/Last.Fm.app/Contents/MacOS/Last.fm"; std::string s = path; s.append( "/Contents/MacOS/Last.fm" ); return s;}
开发者ID:Erkan-Yilmaz,项目名称:lastfm-desktop,代码行数:16,
示例24: memsetOSStatus LLDirPicker::doNavChooseDialog(){ 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 = NavCreateChooseFolderDialog(&mNavOptions, &doNavCallbackEvent, NULL, NULL, &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) { FSRef fsRef; AEKeyword theAEKeyword; DescType typeCode; Size actualSize = 0; char path[LL_MAX_PATH]; /*Flawfinder: ignore*/ memset(&fsRef, 0, sizeof(fsRef)); error = AEGetNthPtr(&navReply.selection, 1, typeFSRef, &theAEKeyword, &typeCode, &fsRef, sizeof(fsRef), &actualSize); if (error == noErr) error = FSRefMakePath(&fsRef, (UInt8*) path, sizeof(path)); if (error == noErr) mDir = path; } return error;}
开发者ID:OS-Development,项目名称:VW.Kirsten,代码行数:47,
示例25: FindApplicationSupportFolderstatic OSErr FindApplicationSupportFolder(FSRef *folderRef, char *folderPath, const char *folderName){ OSErr err; FSRef p2ref, p1ref; CFStringRef fstr; UniChar buffer[PATH_MAX + 1]; UniChar s9xfolder[6] = { 'S', 'n', 'e', 's', '9', 'x' }, oldfolder[6] = { 'S', 'N', 'E', 'S', '9', 'X' }; err = FSFindFolder(kUserDomain, kApplicationSupportFolderType, kCreateFolder, &p2ref); if (err) return (err); err = FSMakeFSRefUnicode(&p2ref, 6, s9xfolder, kTextEncodingUnicodeDefault, &p1ref); if (err == dirNFErr || err == fnfErr) { err = FSMakeFSRefUnicode(&p2ref, 6, oldfolder, kTextEncodingUnicodeDefault, &p1ref); if (err == dirNFErr || err == fnfErr) err = FSCreateDirectoryUnicode(&p2ref, 6, s9xfolder, kFSCatInfoNone, nil, &p1ref, nil, nil); } if (err) return (err); fstr = CFStringCreateWithCString(kCFAllocatorDefault, folderName, CFStringGetSystemEncoding()); CFStringGetCharacters(fstr, CFRangeMake(0, CFStringGetLength(fstr)), buffer); err = FSMakeFSRefUnicode(&p1ref, CFStringGetLength(fstr), buffer, kTextEncodingUnicodeDefault, folderRef); if (err == dirNFErr || err == fnfErr) { err = FSCreateDirectoryUnicode(&p1ref, CFStringGetLength(fstr), buffer, kFSCatInfoNone, nil, folderRef, nil, nil); if (err == noErr) AddFolderIcon(folderRef, folderName); } if (err != noErr && !folderWarning) { AppearanceAlert(kAlertCautionAlert, kFolderFail, kFolderHint); folderWarning = true; } else err = FSRefMakePath(folderRef, (unsigned char *) folderPath, PATH_MAX); CFRelease(fstr); return err;}
开发者ID:BruceJawn,项目名称:flashsnes,代码行数:46,
示例26: isDirWritablebool isDirWritable(FSRef &dir){ bool result = false; // Test for a writable directory by creating a directory, then deleting it again. // This is kinda lame, but will pretty much always give the right answer. OSStatus err = noErr; char temp[PATH_MAX]; /* Flawfinder: ignore */ err = FSRefMakePath(&dir, (UInt8*)temp, sizeof(temp)); if(err == noErr) { temp[0] = '/0'; strncat(temp, "/.test_XXXXXX", sizeof(temp) - 1); if(mkdtemp(temp) != NULL) { // We were able to make the directory. This means the directory is writable. result = true; // Clean up. rmdir(temp); } }#if 0 // This seemed like a good idea, but won't tell us if we're on a volume mounted read-only. UInt8 perm; err = FSGetUserPrivilegesPermissions(&targetParentRef, &perm, NULL); if(err == noErr) { if(perm & kioACUserNoMakeChangesMask) { // Parent directory isn't writable. llinfos << "Target parent directory not writable." << llendl; err = -1; replacingTarget = false; } }#endif return result;}
开发者ID:xinyaojiejie,项目名称:Dale,代码行数:45,
示例27: GetFullPathToDesktopint32 GetFullPathToDesktop(char * fullPath, int32 maxPathLength){ int32 error = 0; if (fullPath == NULL || maxPathLength < 1) return kSPBadParameterError; #if __PIMac__ FSRef fsRef; error = FSFindFolder(kOnSystemDisk, kDesktopFolderType, kDontCreateFolder, &fsRef); if (error) return error; error = FSRefMakePath(&fsRef, (unsigned char*)fullPath, maxPathLength-1); if (PIstrlcat(fullPath, "/", maxPathLength) >= maxPathLength) error = kSPBadParameterError; fullPath[maxPathLength-1]= '/0'; #else if (MAX_PATH <= maxPathLength) { HRESULT hr = SHGetFolderPath( NULL, CSIDL_DESKTOPDIRECTORY, NULL, 0, fullPath ); if (FAILED(hr)) { fullPath[0] = 0; error = kSPBadParameterError; } else { if (PIstrlcat(fullPath, "//", maxPathLength) >= (size_t)maxPathLength) error = kSPBadParameterError; fullPath[maxPathLength-1]= '/0'; } } else { error = kSPBadParameterError; } #endif return error;}
开发者ID:dannyyiu,项目名称:ps-color-test,代码行数:45,
示例28: FT_GetFilePath_From_Mac_ATS_Name FT_GetFilePath_From_Mac_ATS_Name( const char* fontName, UInt8* path, UInt32 maxPathSize, FT_Long* face_index ) { 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 != FSRefMakePath( &ref, path, maxPathSize ) ) return FT_Err_Unknown_File_Format; return FT_Err_Ok; }
开发者ID:32767,项目名称:libgdx,代码行数:18,
注:本文中的FSRefMakePath函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FSTR函数代码示例 C++ FSPathMakeRef函数代码示例 |