📄 macstuff.h
字号:
/*****************************************************************************/pascal OSErr FSpLocationFromFullPath(short fullPathLength, const void *fullPath, FSSpec *spec);/* Get a FSSpec from a full pathname. The FSpLocationFromFullPath function returns a FSSpec to the object specified by full pathname. This function requires the Alias Manager. fullPathLength input: The number of characters in the full pathname of the target. fullPath input: A pointer to a buffer that contains the full pathname of the target. The full pathname starts with the name of the volume, includes all of the directory names in the path to the target, and ends with the target name. spec output: An FSSpec record specifying the object. Result Codes noErr 0 No error nsvErr -35 The volume is not mounted fnfErr -43 Target not found, but volume and parent directory found paramErr -50 Parameter error usrCanceledErr -128 The user canceled the operation __________ See also: LocationFromFullPath*//*****************************************************************************/pascal OSErr GetFullPath(short vRefNum, long dirID, ConstStr255Param name, short *fullPathLength, Handle *fullPath);/* Get a full pathname to a volume, directory or file. The GetFullPath function builds a full pathname to the specified object. The full pathname is returned in the newly created handle fullPath and the length of the full pathname is returned in fullPathLength. Your program is responsible for disposing of the fullPath handle. Note that a full pathname can be made to a file/directory that does not yet exist if all directories up to that file/directory exist. In this case, GetFullPath will return a fnfErr. vRefNum input: Volume specification. dirID input: Directory ID. name input: Pointer to object name, or nil when dirID specifies a directory that's the object. fullPathLength output: The number of characters in the full pathname. If the function fails to create a full pathname, it sets fullPathLength to 0. fullPath output: A handle to the newly created full pathname buffer. If the function fails to create a full pathname, it sets fullPath to NULL. Result Codes noErr 0 No error nsvErr -35 No such volume ioErr -36 I/O error bdNamErr -37 Bad filename fnfErr -43 File or directory does not exist (fullPath and fullPathLength are still valid) paramErr -50 No default volume memFullErr -108 Not enough memory dirNFErr -120 Directory not found or incomplete pathname afpAccessDenied -5000 User does not have the correct access afpObjectTypeErr -5025 Directory not found or incomplete pathname __________ See also: FSpGetFullPath*//*****************************************************************************/pascal OSErr ChangeCreatorType(short vRefNum, long dirID, ConstStr255Param name, OSType creator, OSType fileType);/* Change the creator or file type of a file. The ChangeCreatorType function changes the creator or file type of a file. vRefNum input: Volume specification. dirID input: Directory ID. name input: The name of the file. creator input: The new creator type or 0x00000000 to leave the creator type alone. fileType input: The new file type or 0x00000000 to leave the file type alone. Result Codes noErr 0 No error nsvErr -35 No such volume ioErr -36 I/O error bdNamErr -37 Bad filename fnfErr -43 File not found fLckdErr -45 File is locked vLckdErr -46 Volume is locked or read-only paramErr -50 No default volume dirNFErr -120 Directory not found or incomplete pathname notAFileErr -1302 Name was not a file afpAccessDenied -5000 User does not have the correct access afpObjectTypeErr -5025 Directory not found or incomplete pathname __________ See also: FSpChangeCreatorType*//*****************************************************************************/pascal OSErr FSpChangeCreatorType(const FSSpec *spec, OSType creator, OSType fileType);/* Change the creator or file type of a file. The FSpChangeCreatorType function changes the creator or file type of a file. spec input: An FSSpec record specifying the file. creator input: The new creator type or 0x00000000 to leave the creator type alone. fileType input: The new file type or 0x00000000 to leave the file type alone. Result Codes noErr 0 No error nsvErr -35 No such volume ioErr -36 I/O error bdNamErr -37 Bad filename fnfErr -43 File not found fLckdErr -45 File is locked vLckdErr -46 Volume is locked or read-only paramErr -50 No default volume dirNFErr -120 Directory not found or incomplete pathname notAFileErr -1302 Name was not a file afpAccessDenied -5000 User does not have the correct access afpObjectTypeErr -5025 Directory not found or incomplete pathname __________ See also: ChangeCreatorType*//*****************************************************************************/pascal OSErr BumpDate(short vRefNum, long dirID, ConstStr255Param name);/* Update the modification date of a file or directory. The BumpDate function changes the modification date of a file or directory to the current date/time. If the modification date is already equal to the current date/time, then add one second to the modification date. vRefNum input: Volume specification. dirID input: Directory ID. name input: Pointer to object name, or nil when dirID specifies a directory that's the object. Result Codes noErr 0 No error nsvErr -35 No such volume ioErr -36 I/O error bdNamErr -37 Bad filename fnfErr -43 File not found fLckdErr -45 File is locked vLckdErr -46 Volume is locked or read-only paramErr -50 No default volume dirNFErr -120 Directory not found or incomplete pathname afpAccessDenied -5000 User does not have the correct access afpObjectTypeErr -5025 Directory not found or incomplete pathname __________ See also: FSpBumpDate*//*****************************************************************************/pascal OSErr FSpBumpDate(const FSSpec *spec);/* Update the modification date of a file or directory. The FSpBumpDate function changes the modification date of a file or directory to the current date/time. If the modification date is already equal to the current date/time, then add one second to the modification date. spec input: An FSSpec record specifying the object. Result Codes noErr 0 No error nsvErr -35 No such volume ioErr -36 I/O error bdNamErr -37 Bad filename fnfErr -43 File not found fLckdErr -45 File is locked vLckdErr -46 Volume is locked or read-only paramErr -50 No default volume dirNFErr -120 Directory not found or incomplete pathname afpAccessDenied -5000 User does not have the correct access afpObjectTypeErr -5025 Directory not found or incomplete pathname __________ See also: BumpDate*//*****************************************************************************/pascal OSErr OnLine(FSSpecPtr volumes, short reqVolCount, short *actVolCount, short *volIndex);/* Return the list of volumes currently mounted. The OnLine function returns the list of volumes currently mounted in an array of FSSpec records. A noErr result indicates that the volumes array was filled (actVolCount == reqVolCount) and there may be additional volumes mounted. A nsvErr result indicates that the end of the volume list was found and actVolCount volumes were actually found this time. volumes input: Pointer to array of FSSpec where the volume list is returned. reqVolCount input: Maximum number of volumes to return (the number of elements in the volumes array). actVolCount output: The number of volumes actually returned. volIndex input: The current volume index position. Set to 1 to start with the first volume. output: The volume index position to get the next volume. Pass this value the next time you call OnLine to start where you left off. Result Codes noErr 0 No error, but there are more volumes to list nsvErr -35 No more volumes to be listed paramErr -50 volIndex was <= 0*//*****************************************************************************/pascal OSErr DTGetComment(short vRefNum, long dirID, ConstStr255Param name, Str255 comment);/* Get a file or directory's Finder comment field (if any). The DTGetComment function gets a file or directory's Finder comment field (if any) from the Desktop Manager or if the Desktop Manager is not available, from the Finder's Desktop file. IMPORTANT NOTE: Inside Macintosh says that comments are up to 200 characters. While that may be correct for the HFS file system's Desktop Manager, other file systems (such as Apple Photo Access) return up to 255 characters. Make sure the comment buffer is a Str255 or you'll regret it. vRefNum input: Volume specification. dirID input: Directory ID. name input: Pointer to object name, or nil when dirID specifies a directory that's the object. comment output: A Str255 where the comment is to be returned. Result Codes noErr 0 No error nsvErr -35 Volume not found ioErr -36 I/O error fnfErr -43 File not found paramErr -50 Volume doesn't support this function rfNumErr -51 Reference number invalid extFSErr -58 External file system error - no file system claimed this call. desktopDamagedErr -1305 The desktop database has become corrupted - the Finder will fix this, but if your application is not running with the Finder, use PBDTReset or PBDTDelete afpItemNotFound -5012 Information not found __________ Also see: DTCopyComment, FSpDTCopyComment, DTSetComment, FSpDTSetComment, FSpDTGetComment*//*****************************************************************************/pascal OSErr FSpDTGetComment(const FSSpec *spec, Str255 comment);/* Get a file or directory's Finder comment field (if any). The FSpDTGetComment function gets a file or directory's Finder comment field (if any) from the Desktop Manager or if the Desktop Manager is not available, from the Finder's Desktop file. IMPORTANT NOTE: Inside Macintosh says that comments are up to 200 characters. While that may be correct for the HFS file system's Desktop Manager, other file systems (such as Apple Photo Access) return up to 255 characters. Make sure the comment buffer is a Str255 or you'll regret it. spec input: An FSSpec record specifying the file or directory. comment output: A Str255 where the comment is to be returned. Result Codes noErr 0 No error nsvErr -35 Volume not found ioErr -36 I/O error fnfErr -43 File not found paramErr -50 Volume doesn't support this function rfNumErr -51 Reference number invalid extFSErr -58 External file system error - no file system claimed this call. desktopDamagedErr -1305 The desktop database has become corrupted - the Finder will fix this, but if your application is not running with the Finder, use PBDTReset or PBDTDelete afpItemNotFound -5012 Information not found __________ Also see: DTCopyComment, FSpDTCopyComment, DTSetComment, FSpDTSetComment, DTGetComment*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -