tooly@zelator.uucp (Theo Schneider) (05/10/91)
Hi there, i got an problem with an FilterProc for SFGetFile in Complete Pascal. In the FilterProc i will check if the File have an ResourceFork or not. TB Ref3 says that the Pointer for the FilterProc is an Pointer to an DirEntryRec Template. So i write this FilterProc : {$DefProc} function FilterProc (DirEntry : DirEntryRecPtrGS) : integer; begin if DirEntry^.resourceBlocks <> 0 then FilterProc := displaySelect else FilterProc := noSelect end; If i check the Filetype (esp. if DirEntry^.fileType = $B3), than all is OK but not with resourceBlocks or resourceEOF. PLEASE CAN ANYBODY HELP !! I hope You can read my English and best regards from Germany Theo -- | Theo Schneider |\| UUCP : tooly@zelator.in-berlin.de | | Babelsberger Str. 40 |/| GEnie : T.Schneider6 | | 1000 Berlin 31 |\| Zerberus : T.Schneider@TeleMail.Zer | | Germany |/| Voice : Germany 030 / 854 29 72 |
mattd@Apple.COM (Matt Deatherage) (05/11/91)
In article <NNRQEWO@zelator.uucp> tooly@zelator.uucp (Theo Schneider) writes: >Hi there, > >i got an problem with an FilterProc for SFGetFile in Complete Pascal. >In the FilterProc i will check if the File have an ResourceFork or not. > >TB Ref3 says that the Pointer for the FilterProc is an Pointer to an >DirEntryRec Template. > > | Theo Schneider |\| UUCP : tooly@zelator.in-berlin.de | Correct, but nowhere did it promise it was a _complete_ directory record. If you'll examine DirEntry.pCount, you should find a 13 ($0D), indicating the auxtype is the last field that's filled out. You need to extract the file name from the DirEntry and do a GetFileInfo to get the information you need. You can just examine storageType in the file Info record -- all files with resource forks return storage type $0005. (If you want to save some code execution time, you can leave the code you already have in, and just execute it if the pCount is greater than or equal to 16. That way you won't have to make the GetFileInfo call if future versions of Standard File up the pCount used internally.) -- ============================================================================ Matt Deatherage, Developer Technical | The opinions expressed herein are Support, Apple Computer, Inc. | not those of Apple Computer, and Personal mail only, please. Thanks. | shame on you for thinking otherwise. ============================================================================
dlyons@Apple.COM (David A. Lyons) (05/11/91)
In article <NNRQEWO@zelator.uucp> tooly@zelator.uucp (Theo Schneider) writes: >Hi there, > >i got an problem with an FilterProc for SFGetFile in Complete Pascal. >In the FilterProc i will check if the File have an ResourceFork or not. > >TB Ref3 says that the Pointer for the FilterProc is an Pointer to an >DirEntryRec Template. Matt D's reply is correct, and I have a couple things to add: (1) Future version of standard file will probably provide all the available parameters for you in the DirEntry structure. However, I *don't* recommend that you write code now to check for that case *unless* you're going to actually simulate that happening and trace you code with GSBug. (2) You can get almost the same effect you wanted by checking the Flags parameter (right after ref_num in the template). Bit 15 is set if the file is extended. (It can be extended and still have no blocks in the resource fork, but usually that won't happen anyway.) -- David A. Lyons, Apple Computer, Inc. | DAL Systems Apple II System Software Engineer | P.O. Box 875 America Online: Dave Lyons | Cupertino, CA 95015-0875 GEnie:DAVE.LYONS CompuServe:72177,3233 Internet:dlyons@apple.com My opinions are my own, not Apple's.