本文整理汇总了C++中FSPathMakeRef函数的典型用法代码示例。如果您正苦于以下问题:C++ FSPathMakeRef函数的具体用法?C++ FSPathMakeRef怎么用?C++ FSPathMakeRef使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FSPathMakeRef函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: FT_FSPathMakeRes
static OSErr
FT_FSPathMakeRes( const UInt8* pathname,
short* res )
{
#if HAVE_FSREF
OSErr err;
FSRef ref;
if ( noErr != FSPathMakeRef( pathname, &ref, FALSE ) )
return FT_Err_Cannot_Open_Resource;
/* at present, no support for dfont format */
err = FSOpenResourceFile( &ref, 0, NULL, fsRdPerm, res );
if ( noErr == err )
return err;
/* fallback to original resource-fork font */
*res = FSOpenResFile( &ref, fsRdPerm );
err = ResError();
#else
OSErr err;
FSSpec spec;
if ( noErr != FT_FSPathMakeSpec( pathname, &spec, FALSE ) )
return FT_Err_Cannot_Open_Resource;
/* at present, no support for dfont format without FSRef */
/* (see above), try original resource-fork font */
*res = FSpOpenResFile( &spec, fsRdPerm );
err = ResError();
#endif /* HAVE_FSREF */
return err;
}
开发者ID:HelstVadsom,项目名称:amazing-maze,代码行数:41,代码来源:ftmac.c
示例2: m_dirname
wxDirData::wxDirData(const wxString& dirname)
: m_dirname(dirname)
{
m_ok = false;
OSErr err;
// throw away the trailing slashes
size_t n = m_dirname.length();
wxCHECK_RET( n, _T("empty dir name in wxDir") );
while ( n > 0 && wxIsPathSeparator(m_dirname[--n]) )
;
m_dirname.Truncate(n + 1);
#ifdef __DARWIN__
FSRef theRef;
// get the FSRef associated with the POSIX path
err = FSPathMakeRef((const UInt8 *) m_dirname.c_str(), &theRef, NULL);
FSGetVRefNum(&theRef, &(m_CPB.hFileInfo.ioVRefNum));
err = FSGetNodeID( &theRef , &m_dirId , &m_isDir ) ;
#else
FSSpec fsspec ;
wxMacFilename2FSSpec( m_dirname , &fsspec ) ;
m_CPB.hFileInfo.ioVRefNum = fsspec.vRefNum ;
err = FSpGetDirectoryID( &fsspec , &m_dirId , &m_isDir ) ;
#endif
//wxASSERT_MSG( (err == noErr) || (err == nsvErr) , wxT("Error accessing directory " + m_dirname)) ;
if ( (err == noErr) || (err == nsvErr))
m_ok = true;
else
wxLogError(wxString(wxT("Error accessing directory ")) + m_dirname);
m_CPB.hFileInfo.ioNamePtr = m_name ;
m_index = 0 ;
}
开发者ID:Duion,项目名称:Torsion,代码行数:41,代码来源:dirmac.cpp
示例3: promptForFolder
char* promptForFolder(const char *prompt, const char *defaultPath, char* folderPath, int folderPathLen)
{
char path[PATH_MAX];
OSStatus err;
Boolean isDirectory;
int len;
FSRef ref;
/* Display the prompt. */
if (prompt == NULL)
prompt = "Please enter the path to a folder:";
printf("%s ", prompt);
if (defaultPath != NULL)
printf("[%s] ",defaultPath);
fflush(stdout);
/* Get user input, and trim trailing newlines. */
fgets(path,sizeof(path),stdin);
for (len = strlen(path); len > 0 && path[len-1] == '\n';)
path[--len] = 0;
if (path[0] == 0)
strcpy(path,defaultPath);
/* Expand magic characters just like a shell (mostly so ~ will work) */
expandPathname(path);
/* Convert the path into an FSRef, which is what the burn engine needs. */
err = FSPathMakeRef((const UInt8*)path,&ref,&isDirectory);
if (err != noErr)
{
printf("Bad path. Aborting. (%d)\n", (int)err);
exit(1);
}
if (!isDirectory)
{
printf("That's a file, not a directory! Aborting.\n");
exit(1);
}
return strncpy(folderPath, path, folderPathLen);
}
开发者ID:fruitsamples,项目名称:audioburntest,代码行数:41,代码来源:main.c
示例4: isLink
bool
isLink(const bfs::path& path)
{
if (isSymlink(path)) {
return true;
}
#ifdef MACOSX
// aliases appear as regular files
if (isRegularFile(path)) {
FSRef ref;
if (FSPathMakeRef((const UInt8*)path.c_str(), &ref, NULL) == noErr) {
Boolean isAlias = false, isFolder = false;
if (FSIsAliasFile(&ref, &isAlias, &isFolder) == noErr) {
return isAlias;
}
}
}
#endif
return false;
}
开发者ID:Go-LiDth,项目名称:platform,代码行数:21,代码来源:bpfile_UNIX.cpp
示例5: FSPathMakeFSSpec
OSStatus FSPathMakeFSSpec(const UInt8 *path,FSSpec *spec,Boolean *isDirectory) /* can be NULL */
{
OSStatus result;
FSRef ref;
/* check parameters */
require_action(NULL != spec, BadParameter, result = paramErr);
/* convert the POSIX path to an FSRef */
result = FSPathMakeRef(path, &ref, isDirectory);
require_noerr(result, FSPathMakeRef);
/* and then convert the FSRef to an FSSpec */
result = FSGetCatalogInfo(&ref, kFSCatInfoNone, NULL, NULL, spec, NULL);
require_noerr(result, FSGetCatalogInfo);
FSGetCatalogInfo:
FSPathMakeRef:
BadParameter:
return result;
}
开发者ID:Angeldude,项目名称:pd,代码行数:21,代码来源:vsthost.cpp
示例6: FSPathMakeRef
void CResourceFile::LoadFile( const std::string& fpath )
{
FSRef fileRef;
mResRefNum = -1;
OSStatus resErr = FSPathMakeRef( (const UInt8*) fpath.c_str(), &fileRef, NULL );
if( resErr == noErr )
{
mResRefNum = FSOpenResFile( &fileRef, fsRdPerm );
if( mResRefNum < 0 )
{
fprintf( stderr, "Warning: No Mac resource fork to import.\n" );
resErr = fnfErr;
}
}
else
{
fprintf( stderr, "Error: Error %d locating input file's resource fork.\n", (int)resErr );
mResRefNum = -1;
}
}
开发者ID:UncombedCoconut,项目名称:stackimport,代码行数:21,代码来源:CResourceFile.cpp
示例7: PortBurn_EndTrack
/* Finish the current audio track. */
int PortBurn_EndTrack(void *handle)
{
PBHandle *h = (PBHandle *)handle;
DRAudioTrackRef track;
Boolean isDirectory;
const char *filename;
FSRef fsref;
int index;
if (!h)
return pbErrNoHandle;
if (!h->staging)
return pbErrMustCallStartStaging;
if (0 != PortBurn_EndStagingTrack(h->staging))
return pbErrCannotStageTrack;
index = PortBurn_GetNumStagedTracks(h->staging);
if (index <= 0)
return pbErrCannotStageTrack;
filename = PortBurn_GetStagedFilename(h->staging, index - 1);
printf("Filename: '%s'\n", filename);
h->err = FSPathMakeRef((const UInt8*)filename, &fsref, &isDirectory);
if (h->err != noErr)
return pbErrCannotAccessStagedFile;
if (isDirectory)
return pbErrCannotAccessStagedFile;
track = DRAudioTrackCreate(&fsref);
CFArrayAppendValue(h->trackArray, track);
CFRelease(track);
if (track)
return pbSuccess;
else
return pbErrCannotUseStagedFileForBurning;
}
开发者ID:AkiraShirase,项目名称:audacity,代码行数:41,代码来源:portburn_macosx.c
示例8: TRASH_CanTrashFile
BOOL TRASH_CanTrashFile(LPCWSTR wszPath)
{
char *unix_path;
OSStatus status;
FSRef ref;
FSCatalogInfo catalogInfo;
TRACE("(%s)\n", debugstr_w(wszPath));
if (!(unix_path = wine_get_unix_file_name(wszPath)))
return FALSE;
status = FSPathMakeRef((UInt8*)unix_path, &ref, NULL);
heap_free(unix_path);
if (status == noErr)
status = FSGetCatalogInfo(&ref, kFSCatInfoVolume, &catalogInfo, NULL,
NULL, NULL);
if (status == noErr)
status = FSFindFolder(catalogInfo.volume, kTrashFolderType,
kCreateFolder, &ref);
return (status == noErr);
}
开发者ID:ccpgames,项目名称:wine,代码行数:22,代码来源:trash.c
示例9: wd_apple_resolve_alias
int wd_apple_resolve_alias(char *dst, char *src, size_t size) {
FSRef fsPath;
Boolean isDir, isAlias;
strlcpy(dst, src, size);
if(!wd_chroot) {
if(FSPathMakeRef(src, &fsPath, NULL) != 0)
return -1;
if(FSIsAliasFile(&fsPath, &isAlias, &isDir) != 0)
return -1;
if(FSResolveAliasFile(&fsPath, true, &isDir, &isAlias) != 0)
return -1;
if(FSRefMakePath(&fsPath, dst, size) != 0)
return -1;
}
return 1;
}
开发者ID:ProfDrLuigi,项目名称:zanka,代码行数:22,代码来源:utility.c
示例10: defined
std::unique_ptr<ImportFileHandle> QTImportPlugin::Open(const wxString & Filename)
{
OSErr err;
FSRef inRef;
Movie theMovie = NULL;
Handle dataRef = NULL;
OSType dataRefType = 0;
short resID = 0;
#if defined(__WXMAC__)
err = wxMacPathToFSRef(Filename, &inRef);
#else
// LLL: This will not work for pathnames with Unicode characters...find
// another method.
err = FSPathMakeRef((UInt8 *)OSFILENAME(Filename), &inRef, NULL);
#endif
if (err != noErr) {
return nullptr;
}
err = QTNewDataReferenceFromFSRef(&inRef, 0, &dataRef, &dataRefType);
if (err != noErr) {
return nullptr;
}
// instantiate the movie
err = NewMovieFromDataRef(&theMovie,
newMovieActive | newMovieDontAskUnresolvedDataRefs,
&resID,
dataRef,
dataRefType);
DisposeHandle(dataRef);
if (err != noErr) {
return nullptr;
}
return std::make_unique<QTImportFileHandle>(Filename, theMovie);
}
开发者ID:finefin,项目名称:audacity,代码行数:39,代码来源:ImportQT.cpp
示例11: FT_FSPathMakeRes
static OSErr
FT_FSPathMakeRes( const UInt8* pathname,
ResFileRefNum* res )
{
OSErr err;
FSRef ref;
if ( noErr != FSPathMakeRef( pathname, &ref, FALSE ) )
return FT_Err_Cannot_Open_Resource;
/* at present, no support for dfont format */
err = FSOpenResourceFile( &ref, 0, NULL, fsRdPerm, res );
if ( noErr == err )
return err;
/* fallback to original resource-fork font */
*res = FSOpenResFile( &ref, fsRdPerm );
err = ResError();
return err;
}
开发者ID:32767,项目名称:libgdx,代码行数:22,代码来源:ftmac.c
示例12: setup
/*AudioFile::AudioFile( shared_ptr<IStream> aStream ) : mStream( aStream )
{
setup();
}*/
AudioFile::AudioFile( const std::string &aFilePath )
{
#if defined( FLI_MAC )
FSRef fsref;
OSStatus fileRefError = FSPathMakeRef( (const UInt8 *)aFilePath.c_str(), &fsref, NULL );
if( fileRefError ) {
//handle error
std::cout << "Input file not found" << std::endl;
return;
}
OSStatus audioFileOpenError = AudioFileOpen(&fsref, fsRdPerm, 0, &mNativeFileRef);
if( audioFileOpenError ) {
//handle error
std::cout << "AudioFileOpen failed" << std::endl;
return;
}
loadHeader();
load();
#endif
}
开发者ID:AaronMeyers,项目名称:Cinder,代码行数:26,代码来源:AudioFile.cpp
示例13: main
int main (int argc, const char *argv[]) {
SInt32 fileID;
FSRef ref, volRef;
FSCatalogInfo volCatInfo;
OSErr result;
unsigned char pathName[255];
// Exit if anything more or less than two arguments are passed in
if (argc != 3) {
printf("Usage: %s <HFS ID> <volume mount point>\n", argv[0]);
return 0;
}
result = FSPathMakeRef(argv[2], &volRef, NULL);
if (result != noErr) {
printf("Error %d\n", result);
return 10;
}
result = FSGetCatalogInfo(&volRef, kFSCatInfoVolume, &volCatInfo, NULL, NULL, NULL);
if (result != noErr) {
printf("Error %d\n", result);
return 10;
}
fileID = atoi(argv[1]);
result = FSResolveFileIDRef(volCatInfo.volume, fileID, &ref);
if (result != noErr) {
printf("Error %d\n", result);
return 10;
}
result = FSRefMakePath(&ref, pathName, sizeof(pathName));
if (result != noErr) {
printf("Error %d\n", result);
return 10;
}
printf("%s\n", pathName);
return 0;
}
开发者ID:c0sco,项目名称:lookupid,代码行数:39,代码来源:main.c
示例14: myFSCreateResFile
static OSErr myFSCreateResFile(const char *path, OSType creator, OSType fileType, FSRef *outRef) {
int fd = open(path, O_CREAT | O_WRONLY, 0666);
if (fd == -1) {
perror("opening destination:");
return bdNamErr;
}
close(fd);
FSRef ref;
OSErr err = FSPathMakeRef((const UInt8*)path, &ref, NULL);
if (err != noErr)
return err;
HFSUniStr255 rname;
FSGetResourceForkName(&rname);
err = FSCreateResourceFork(&ref, rname.length, rname.unicode, 0);
if (err != noErr)
return err;
FInfo finfo;
err = FSGetFInfo(&ref, &finfo);
if (err != noErr)
return err;
finfo.fdCreator = creator;
finfo.fdType = fileType;
err = FSSetFInfo(&ref, &finfo);
if (err != noErr)
return err;
*outRef = ref;
return noErr;
}
开发者ID:specious,项目名称:osxutils,代码行数:38,代码来源:mkalias.c
示例15: FSPathMakeRef
/********** HELPER FUNCTIONS ***********/
static const char *GetSpecialPathName(const char *Path)
{
if(GetProductIsAppBundle(cur_info))
{
FSRef Ref;
HFSUniStr255 SpecialPathHFS;
FSPathMakeRef(Path, &Ref, NULL);
FSGetCatalogInfo(&Ref, kFSCatInfoNone, NULL, &SpecialPathHFS, NULL, NULL);
CFStringRef cfs = CFStringCreateWithCharacters(kCFAllocatorDefault, SpecialPathHFS.unicode, SpecialPathHFS.length);
CFStringGetCString(cfs, SpecialPath, 1024, kCFStringEncodingASCII);
CFRelease(cfs);
return SpecialPath;
/*// Otherwise, it'll show /Users/joeshmo/Desktop.
if(strstr(Path, DesktopName) != NULL)
return DesktopName;
else if(strstr(Path, DocumentsName) != NULL)
return DocumentsName;
else if(strstr(Path, ApplicationsName) != NULL)
return ApplicationsName;*/
}
return Path;
}
开发者ID:BackupTheBerlios,项目名称:geoirc,代码行数:24,代码来源:carbon_ui.c
示例16: switch
//static
pascal void LLFilePickerBase::doNavCallbackEvent(NavEventCallbackMessage callBackSelector,
NavCBRecPtr callBackParms, void* callBackUD)
{
switch(callBackSelector)
{
case kNavCBStart:
{
LLFilePickerBase* picker = reinterpret_cast<LLFilePickerBase*>(callBackUD);
if (picker->getFolder().empty()) break;
OSStatus error = noErr;
AEDesc theLocation = {typeNull, NULL};
FSSpec outFSSpec;
//Convert string to a FSSpec
FSRef myFSRef;
const char* folder = picker->getFolder().c_str();
error = FSPathMakeRef ((UInt8*)folder, &myFSRef, NULL);
if (error != noErr) break;
error = FSGetCatalogInfo (&myFSRef, kFSCatInfoNone, NULL, NULL, &outFSSpec, NULL);
if (error != noErr) break;
error = AECreateDesc(typeFSS, &outFSSpec, sizeof(FSSpec), &theLocation);
if (error != noErr) break;
error = NavCustomControl(callBackParms->context,
kNavCtlSetLocation, (void*)&theLocation);
}
}
}
开发者ID:NickyPerian,项目名称:SingularityViewer,代码行数:38,代码来源:llfilepicker.cpp
示例17: _q_isMacHidden
static bool _q_isMacHidden(const QString &path)
{
OSErr err = noErr;
FSRef fsRef;
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
err = FSPathMakeRefWithOptions(reinterpret_cast<const UInt8 *>(QFile::encodeName(QDir::cleanPath(path)).constData()),
kFSPathMakeRefDoNotFollowLeafSymlink, &fsRef, 0);
} else
#endif
{
QFileInfo fi(path);
FSRef parentRef;
err = FSPathMakeRef(reinterpret_cast<const UInt8 *>(fi.absoluteDir().absolutePath().toUtf8().constData()),
&parentRef, 0);
if (err == noErr) {
QString fileName = fi.fileName();
err = FSMakeFSRefUnicode(&parentRef, fileName.length(),
reinterpret_cast<const UniChar *>(fileName.unicode()),
kTextEncodingUnknown, &fsRef);
}
}
if (err != noErr)
return false;
FSCatalogInfo catInfo;
err = FSGetCatalogInfo(&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL);
if (err != noErr)
return false;
FileInfo * const fileInfo = reinterpret_cast<FileInfo*>(&catInfo.finderInfo);
bool result = (fileInfo->finderFlags & kIsInvisible);
return result;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:36,代码来源:qfsfileengine_unix.cpp
示例18: get_file_type_from_path
/* Return the file type for given pathname */
static OSType
get_file_type_from_path( const UInt8* pathname )
{
#if HAVE_FSREF
FSRef ref;
FSCatalogInfo info;
if ( noErr != FSPathMakeRef( pathname, &ref, FALSE ) )
return ( OSType ) 0;
if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoFinderInfo, &info,
NULL, NULL, NULL ) )
return ( OSType ) 0;
return ((FInfo *)(info.finderInfo))->fdType;
#else
FSSpec spec;
FInfo finfo;
if ( noErr != FT_FSPathMakeSpec( pathname, &spec, FALSE ) )
return ( OSType ) 0;
if ( noErr != FSpGetFInfo( &spec, &finfo ) )
return ( OSType ) 0;
return finfo.fdType;
#endif /* HAVE_FSREF */
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:37,代码来源:ftmac.c
示例19: FindCustomFolder
static OSStatus FindCustomFolder (FSRef *folderRef, char *folderPath, const char *folderName)
{
OSStatus err;
CFStringRef fstr;
FSRef pref;
UniChar buffer[PATH_MAX + 1];
char s[PATH_MAX + 1];
if (saveFolderPath == NULL)
return (-1);
err = CFStringGetCString(saveFolderPath, s, PATH_MAX, kCFStringEncodingUTF8) ? noErr : -1;
if (err == noErr)
err = FSPathMakeRef((unsigned char *) s, &pref, NULL);
if (err)
return (err);
fstr = CFStringCreateWithCString(kCFAllocatorDefault, folderName, CFStringGetSystemEncoding());
CFStringGetCharacters(fstr, CFRangeMake(0, CFStringGetLength(fstr)), buffer);
err = FSMakeFSRefUnicode(&pref, CFStringGetLength(fstr), buffer, kTextEncodingUnicodeDefault, folderRef);
if (err == dirNFErr || err == fnfErr)
{
err = FSCreateDirectoryUnicode(&pref, CFStringGetLength(fstr), buffer, kFSCatInfoNone, NULL, folderRef, NULL, NULL);
if (err == noErr)
AddFolderIcon(folderRef, folderName);
}
if (err == noErr)
err = FSRefMakePath(folderRef, (unsigned char *) folderPath, PATH_MAX);
CFRelease(fstr);
return (err);
}
开发者ID:7sevenx7,项目名称:snes9x,代码行数:36,代码来源:mac-file.cpp
示例20: memset
void nglDataFilesObject::SetDragItemFlavorData(DragRef dragRef, DragItemRef& itemRef, FlavorType flavorType)
{
OSErr err = noErr;
nglString file;
std::list<DragItemRef>::iterator iRef = mItemRefs.begin();
for (std::list<nglString>::const_iterator i = GetFiles().begin(); i != GetFiles().end() && iRef != mItemRefs.end(); ++i, ++iRef)
{
if (itemRef == *iRef)
{
HFSFlavor hfsInfo;
FSRef fileRef;
int32 start = 0;
int32 len = 1023;
char str[1024];
memset(str, 0, 1024);
i->Export(start, str, len, eUTF8);
err = FSPathMakeRef((const UInt8*)str, &fileRef, NULL);
NGL_ASSERT(!err);
FSCatalogInfo catInfo;
err = FSGetCatalogInfo(&fileRef, kFSCatInfoFinderInfo, &catInfo, NULL, &(hfsInfo.fileSpec), NULL);
NGL_ASSERT(!err);
FileInfo* finfo = (FileInfo*) &catInfo.finderInfo;
hfsInfo.fdFlags = finfo->finderFlags;
hfsInfo.fileType = finfo->fileType;
hfsInfo.fileCreator = finfo->fileCreator;
err = ::SetDragItemFlavorData(dragRef, itemRef, kDragFlavorTypeHFS, &hfsInfo, sizeof (hfsInfo), 0);
NGL_ASSERT(!err);
//NGL_OUT("Adding file to drag data, itemRef is %d: %s\n", itemRef, (*i).GetChars());
return;
}
}
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:36,代码来源:nglDataObjects_Carbon.cpp
注:本文中的FSPathMakeRef函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论