PBSetFVersSync
PBSetFVers Change a file's version number (flat volumes only)
#include <Files.h> File Manager (PBxxx)
OSErr PBSetFVers(pb, async ); Boolean async ; 0=await completion; 1=immediate return PBSetFVers has no effect on HFS volumes. On flat volumes, it changes a
file's version number.
pb is the address of a 50-byte IOParam structure. The relevant fields are as follows:
Out-In Name Type Size Offset Description
-> ioCompletion ProcPtr 4 12 Completion routine address (if async =TRUE) -> ioNamePtr StringPtr 4 18 Address of full or partial path/ filename -> ioVRefNum short 2 22 Volume, drive, or directory reference
-> ioVersNum SignedByte 1 26 Current version number -> ioMisc Ptr 4 28 Desired version number in high-order byte <- ioResult OSErr 2 16 Error Code (0=no error, 1=not done yet) async is a Boolean value. Use FALSE for normal (synchronous) operation or TRUE to enqueue the request and resume control immediately. See Async I/O.
noErr (0) No error
bdNamErr (-37) Bad name
dupFNErr (-48) Duplicate filename has this version number
extFSErr (-58) External file system
fLckdErr (-45) File is locked
fnfErr (-43) File not found
ioErr (-36) I/O error
nsvErr (-35) No such volume
paramErr (-50) No default volume
vLckdErr (-46) Volume is locked
wPrErr (-44) Diskette is write-protected
wrgVolTypErr (-123) Wrong volume type - invalid for HFS volumes
Notes: The concept of a file version number is an example of a good intention
unfulfilled since the Finder and Standard File Package no longer recognize
file versions.
Note: A file with a version number other than 0 will not be seen and cannot be selected in the SFGetFile window - you might use this function as a way to hide a file from selection via Standard File.
You may want to use PBSetFVers to set a file's version number to 0, in
order to make it more compatible with HFS.
The desired version number must be placed in the high byte of the ioMisc
field which is a Ptr so type coercion is needed e.g.,
pb.ioVersNum=12; /* current version is 12 */
pb.ioMisc = (Ptr) (13L << 24) /* new version is 13 */
If you don't know the version number of a particular file, you can use
PBGetFInfo to index through the files in a volume, looking for a match on the filename.