home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / FSpDelTree 1.10 / FSpDelTree Reference next >
Encoding:
Text File  |  1995-08-16  |  5.3 KB  |  68 lines  |  [TEXT/ttxt]

  1. FSpDelTree 1.10
  2.  
  3. WARNING:  USE "FSPDELTREE" AT YOUR OWN RISK!!!  THE AUTHOR ASSUMES NO RESPONSIBILTY FOR THE PERFORMANCE OR RELIABILITY OF THIS SOFTWARE OR ITS ACCOMPANYING DOCUMENTATION!!!
  4.  
  5.  
  6. Intro
  7. Among all the wonderful directory and file management routines described by Apple in their "Inside Macintosh - Files" publication, none that I'm aware of is able to delete a non-empty directory.  While protecting unknowledgeable, absent-minded, or otherwise careless end users from unintentionally deleting populated directories is clearly desirable, this author feels that (hopefully) competent Macintosh developers should have this common directory management capability.  The "FSpDelTree" project has been undertaken to fill this gap.
  8.  
  9.  
  10. The Files
  11. The "FSpDelTree 1.10" release is comprised of three files, as follows:
  12.  
  13.    • "FSpDelTree Release Notes" - the text document you are currently reading
  14.    • "FSpDelTree.c.o"           - an MPW 3.3.x-created C-language object file
  15.    • "FSpDelTree.h"             - an MPW 3.3.x-created C-language header file
  16.  
  17.  
  18. The Function
  19. The public interface to the "FSpDelTree" function, as declared in the "FSpDelTree.h" header file, is:
  20.  
  21.    short FSpDelTree(FSSpecPtr theDeadTree);
  22.  
  23. The "FSpDelTree" function therefore accepts one argument of type FSSpecPtr.  The type FSSpecPtr is defined by Apple as a pointer to an FSSpec structure.  The FSSpec structure is also defined by Apple (for specific details regarding these types, please refer to Apple's "Inside Macintosh - Files" publication).  Like all the Apple-defined routines described in "Inside Macintosh" that work with FSSpec structures, my "FSpDelTree" function requires Mac System 7.0 or later.
  24.  
  25. The "FSpDelTree" function returns a short integer value.  This value corresponds to the error codes defined by Apple in the "Errors.h" C-language header file.
  26.  
  27.  
  28. More Specifics
  29. "FSpDelTree" accepts and will attempt to process any pointer to an FSSpec structure.  Therein lies both the power and the danger of using "FSpDelTree".
  30.  
  31. "FSpDelTree" works like the MS-DOS 6.x "deltree" command:  it deletes a directory and all the subdirectories and files within.  As with the "deltree" command, "FSpDelTree" also works on files.  Since it is possible to create FSSpec structures that represent any directory or file, it is possible to delete any directory or file.  "FSpDelTree" does not discriminate on the basis of age, size, color, locked status (files only), or contents.  In short, if a file system object (a directory or a file) exists before you call "FSpDelTree", that object will in most cases NOT exist when "FSpDelTree" returns.
  32.  
  33. "In most cases", you ask?  Yes, exceptions to this rule are that "FSpDelTree" cannot delete directories or files that are currently in use, such as a running application (attempting to do so results in an error -47 being returned).  Also, "FSpDelTree" makes some attempt to verify that you have passed it a valid pointer to an FSSpec structure.  As a precaution against accidentally deleting the default directory, "FSpDelTree" will not process requests to delete the default directory on the default drive (attempting to do so results in an error 128 being returned).
  34.  
  35. However, "FSpDelTree" cannot read your mind...  in the end, it is your resposibility to exercise caution and make sure you are passing the correct information to "FSpDelTree".  I STRONGLY URGE anyone who uses "FSpDelTree" to pass it only the address of structures that have been populated by Apple's "FSMakeFSSpec" function. 
  36.  
  37. Common returned values from "FSpDelTree" calls include:
  38.  
  39.        0   no error
  40.      -35   volume not found
  41.      -43   file not found
  42.      -47   file busy (you tried to delete a file that is in use)
  43.      128   operation aborted ("FSpDelTree" detected defaults in your FSSpec)
  44.  
  45.  
  46. Bugs
  47. I (and others) have more or less fully tested my "FSpDelTree" routine and I believe that we have eliminated all the major bugs.  Kindly report any remaining bugs that you may find to one of my electronic mail addresses provided below.
  48.  
  49.  
  50. Caveat Emptor
  51. FSpDelTree 1.10 is the first version to be released/unleashed on the public.  Previous versions have been incorporated into in-house projects and seem to be working reliably.  At this point, I guess it bears repeating that you must USE "FSPDELTREE" AT YOUR OWN RISK!!!  THE AUTHOR ASSUMES NO RESPONSIBILTY FOR THE PERFORMANCE OR RELIABILITY OF THIS SOFTWARE OR ITS ACCOMPANYING DOCUMENTATION!!!
  52.  
  53. The entire "FSpDelTree" project has been written, tested, and produced by the author, James K. Toothman of Essential Technologies.  This product is copyrighted by the author and all rights are reserved.  This product is intended to be distributed as FREEWARE, meaning you may redistribute it freely as long as you do not eliminate or modify the contents of any of the files.  You MAY NOT charge a fee for this product.
  54.  
  55. Comments, questions, and/or bug reports regarding this product may be directed to the author:
  56.  
  57.      James K. Toothman
  58.      Essential Technologies
  59.      54 Valley Road
  60.      Glen Rock, NJ  07452-1712
  61.  
  62.      AppleLink:  JT.ESSENTIAL
  63.      AOL:        EssentialT
  64.      Prodigy:    XTWM92F
  65.  
  66. Anyone wishing to do so may register with me by mail, and I will gladly provide additional FREE upgrades to this product if and when they become available.  Please include your name, address, and a crispy, new $1.00 bill (to cover the cost of the diskette and mailing).
  67.  
  68. "FSpDelTree" is a product of the U.S.A.