Important: The information in this document is obsolete and should not be used for new development.
Figures, Tables, and Listings
Preface About This Book xvChapter 1 Introduction to File Management 1-3
Figure 1-1 The two forks of a Macintosh file 1-5
Figure 1-2 Logical blocks and allocation blocks 1-7
Figure 1-3 Logical end-of-file and physical end-of-file 1-8
Figure 1-4 The Macintosh hierarchical file system 1-10
Figure 1-5 The disk switch dialog box 1-11
Figure 1-6 A typical File menu 1-12
Listing 1-1 Handling the File menu commands 1-13
Listing 1-2 Testing for the availability of routines that operate on FSSpec records 1-14
Listing 1-3 A sample document record 1-15
Listing 1-4 Handling the New menu command 1-16
Listing 1-5 Creating a new document window 1-17
Listing 1-6 Handling the Open menu command 1-19
Figure 1-7 The default Open dialog box 1-19
Listing 1-7 Opening a file 1-20
Listing 1-8 Reading data from a file 1-22
Listing 1-9 Writing data into a file 1-24
Listing 1-10 Updating a file safely 1-25
Listing 1-11 Handling the Save menu command 1-26
Listing 1-12 Handling the Save As menu command 1-27
Figure 1-8 The default Save dialog box 1-28
Figure 1-9 The new folder dialog box 1-29
Figure 1-10 The name conflict dialog box 1-29
Listing 1-13 Copying a resource from one resource fork to another 1-30
Figure 1-11 A Revert to Saved dialog box 1-30
Listing 1-14 Handling the Revert to Saved menu command 1-31
Listing 1-15 Handling the Close menu command 1-32
Listing 1-16 Closing a file 1-33
Listing 1-17 Opening files at application launch time 1-35
Listing 1-18 Opening a preferences file 1-36
Listing 1-19 Adjusting the File menu 1-37
Table 2-1 Routines for opening file forks 2-7
Table 2-2 Routines for operating on open file forks 2-9
Table 2-3 Routines for operating on closed files 2-9
Table 2-4 Routines for operating on directories 2-10
Table 2-5 Routines for manipulating working directories 2-11
Table 2-6 Routines for operating on volumes 2-12
Table 2-7 Routines for manipulating working directories 2-13
Table 2-8 Shared environment routines 2-15
Figure 2-1 Access and deny mode synchronization 2-16
Table 2-9 Access mode translation 2-17
Figure 2-2 Access privileges information in the ioACAccess field 2-19
Figure 2-3 Identifying a file in HFS 2-30
Listing 2-1 Testing for PBCatSearch 2-34
Table 2-10 How FSMakeFSSpec interprets its parameters 2-36
Listing 2-2 Deleting a file's resource fork 2-38
Table 2-12 Fields in ioSearchInfo1 and ioSearchInfo2 used for a directory 2-40
Table 2-11 Fields in ioSearchInfo1 and ioSearchInfo2 used for a file 2-40
Listing 2-3 Searching a volume with PBCatSearch 2-42
Listing 2-4 Searching a volume using a recursive, indexed search 2-44
Listing 2-5 Constructing the full pathname of a file 2-46
Listing 2-6 Determining the amount of free space on a volume 2-48
Listing 2-7 Determining whether a volume is sharable 2-49
Listing 2-8 Determining whether file sharing is enabled 2-50
Listing 2-9 Determining whether a file can have ranges locked 2-51
Listing 2-10 Locking a file range to append data to the file 2-52
Figure 2-4 Organization of partitions on a disk 2-56
Figure 2-5 Organization of a volume 2-57
Figure 2-6 The structure of a B*-tree file 2-64
Figure 2-7 The structure of a node 2-65
Figure 2-8 Structure of a B*-tree node record 2-67
Figure 2-9 A sample B*-tree 2-68
Figure 2-10 Header node structure 2-69
Listing 2-11 Reading a drive queue element's flag bytes 2-86
Chapter 3 Standard File Package 3-3
Figure 3-1 The default Open dialog box 3-5
Figure 3-2 The default Save dialog box 3-6
Figure 3-3 The New Folder dialog box 3-6
Figure 3-4 The name conflict dialog box 3-7
Figure 3-5 The Save dialog box customized with radio buttons 3-8
Figure 3-6 The Save dialog box customized with a pop-up menu 3-9
Figure 3-7 The Open dialog box customized with a pop-up menu 3-9
Figure 3-8 The Open dialog box customized to allow selection of a directory 3-10
Figure 3-9 The Open dialog box when no directory is selected 3-11
Figure 3-10 The Open dialog box with a long directory name abbreviated 3-11
Figure 3-11 A volume selection dialog box 3-12
Listing 3-1 Handling the Open menu command 3-14
Listing 3-2 Specifying more than four file types 3-15
Listing 3-3 Presenting a customized Open dialog box 3-17
Listing 3-4 The definition of the default Open dialog box 3-18
Listing 3-5 The definition of the default Save dialog box 3-18
Listing 3-6 The item list for the default Open dialog box 3-18
Listing 3-7 The item list for the default Save dialog box 3-19
Listing 3-8 A sample file filter function 3-21
Listing 3-9 A sample dialog hook function 3-27
Listing 3-10 A sample modal-dialog filter function 3-30
Listing 3-11 Determining the current directory 3-31
Listing 3-12 Determining the current volume 3-32
Listing 3-13 Setting the current directory 3-32
Listing 3-14 Setting the current volume 3-32
Listing 3-15 Setting the current directory 3-33
Listing 3-16 A file filter function that lists only directories 3-34
Listing 3-17 Setting a button's title 3-35
Listing 3-18 Handling user selections in the directory selection dialog box 3-35
Listing 3-19 Presenting the directory selection dialog box 3-37
Listing 3-20 A file filter function that lists only volumes 3-38
Listing 3-21 Handling user selections in the volume selection dialog box 3-39
Listing 3-22 Presenting the volume selection dialog box 3-40
Figure 4-1 Resolving a relative path 4-6
Listing 4-1 Creating an alias record 4-9
Listing 4-2 Storing an alias record as a resource 4-12
Chapter 5 Disk Initialization Manager 5-3
Figure 5-1 The disk initialization dialog box 5-5
Figure 5-2 Alternate buttons for the disk initialization dialog box 5-6
Figure 5-3 The disk initialization warning 5-6
Figure 5-4 The disk naming dialog box 5-6
Figure 5-5 The Finder's disk erasing dialog box 5-7
Listing 5-1 Responding to disk-inserted events 5-10
Listing 5-2 Reinitializing a valid disk 5-11
Listing 5-3 Reinitializing a validly formatted disk without using the standard interface 5-12
Listing 5-4 Initializing an uninitialized disk without using the standard interface 5-13
Listing 5-5 Changing default volume characteristics 5-15