Professional Web Applications Themes

This SHOULD be simple, but seems impossible... Help? - Mac Programming

While reading this, please keep in mind that I'm writing to target Carbon (and maybe later, "plain old Mac Toolbox") on 9.x and earlier systems. No MacOS X development capability here, so giving me "X-based" advice (unless it's got an exact counterpart in Carbon) is just a waste of time and bandwidth for both of us. I can do a FindFolder(kOnSystemDisk, 'pref', kCreateFolder, &FoundVRefNum, &FoundDirNum) call and locate (or, in the incredibly unlikely event that my app is the first thing to be run after the user has wiped out the entire Preferences folder, create) the Prefs folder, and learn ...

  1. #1

    Default This SHOULD be simple, but seems impossible... Help?

    While reading this, please keep in mind that I'm writing to target
    Carbon (and maybe later, "plain old Mac Toolbox") on 9.x and earlier
    systems. No MacOS X development capability here, so giving me "X-based"
    advice (unless it's got an exact counterpart in Carbon) is just a waste
    of time and bandwidth for both of us.

    I can do a FindFolder(kOnSystemDisk, 'pref', kCreateFolder,
    &FoundVRefNum, &FoundDirNum) call and locate (or, in the incredibly
    unlikely event that my app is the first thing to be run after the user
    has wiped out the entire Preferences folder, create) the Prefs folder,
    and learn its VRefNum/DirID info. That part isn't a problem.

    Once I know the VRef/DirID of the prefs folder, I can do this:
    FSMakeFSSpec(FoundVRefNum, FoundDirNum, "\pMyApp Prefs", &aFileSpec)

    Which accomplishes two things-
    1) It tells me that "MyApp Prefs" does or does not currently exist in
    the Preferences folder. (By checking the result from FSMakeFSSpec)
    2) It creates the FSSpec for it, whether it exists or not.

    Based on the result from FSMakeFSSpec, I'll need to do one of two
    things:
    1) If "MyApp Prefs" DOES NOT exist (Result from FSMakeFSSpec == -43), I
    need to create the folder. No big deal. Based on what I know right now,
    I'll almost certainly do that by using a line of code similar to
    "FSpDirCreate(aFileSpec, smSystemScript, &CreatedDirID)".

    Assuming this call comes back with a noErr result, I've got the VRefNum
    (From FindFolder) and DirID of the newly created "MyApp Prefs" folder
    (stashed in CreatedDirID), and I'm golden. Everything's "kid simple"
    from here.

    2) If "<Startup volume>:System Folder:Preferences:MyApp Prefs" DOES
    already exist, as reported by the results of MakeFSSpec() and friends,I
    hit a wall - I can FSOpen(), FSDelete(), or otherwise manipulate the
    folder, but so far, I haven't got a clue how to get the DirID that goes
    with it so that I can operate on (determine existence/nonexistence of
    one of several application settings files I need to work with,
    open/read, open/write, or create/open/write them as needed by the app's
    behavior, and so on) files inside it.

    That's where you, the reader of this cry for help, come in...

    How do I figure out the DirectoryID of *AN ALREADY EXISTING* folder
    *OTHER THAN* one of the dozen or so "special" folders that FindFolder
    recognizes? Getting this information for a folder that I need to create
    is easy, and in fact, is given to me as a sort of "free bonus" in the
    course of creating the folder. But if it already exists, I can't figure
    out how to get its DirID, which is pretty well killing my ability to do
    anything further with the files that are (supposed to be...) stored in
    it.

    I guess I *COULD* simply scatter my files around in the Pref folder, but
    I would *VERY* strongly prefer to have everything tucked neatly into a
    sub-folder that lives in the Prefs folder.

    Any help here?

    --
    Don Bruder - net - New Email policy in effect as of Feb. 21, 2004.
    I respond to Email as quick as humanly possible. If you Email me and get no
    response, see <http://www.sonic.net/~dakidd/main/contact.html> Short
    form: I'm trashing EVERYTHING that doesn't contain a password in the subject.
    Don Guest

  2. #2

    Default Re: This SHOULD be simple, but seems impossible... Help?

    In article <xiuoc.10954$sonic.net>,
    Don Bruder <net> wrote:
     

    You have the FSSpec for the folder. If you take the name in that FSSpec and
    append to it ":FileName", then pass that to FSMakeFSSpec, you will get the
    FSSpec for the file in the folder, which also includes the dirID of the folder.

    There are also way to do this using FSGetCatalogInfo and PBGetCatInfo, but they
    are more involved and you need the child FSSpec anyway.

    hth

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Guest

  3. #3

    Default Re: This SHOULD be simple, but seems impossible... Help?

    In article <mit.edu>,
    Miro Jurisic <org> wrote:
     
     

    <"I coulda hadda V8" forehead smack, accompanied by heartfelt "D'OH!">

    Why didn't I think of that? <sigh>

    I was right - it *SHOULD* be simple. Because it *IS* simple - When you
    get your head out of the rut that you've gotten it into while trying to
    find a way to do it!
     

    I'll take a pass on "more involved" at this point... If I get much more
    "involved", I'm gonna hafta start paying alimony to this darn program!
    :)

    Thanks Mr. J :)

    --
    Don Bruder - net - New Email policy in effect as of Feb. 21, 2004.
    I respond to Email as quick as humanly possible. If you Email me and get no
    response, see <http://www.sonic.net/~dakidd/main/contact.html> Short
    form: I'm trashing EVERYTHING that doesn't contain a password in the subject.
    Don Guest

Similar Threads

  1. DXF - Relatively Impossible
    By Peter_Witt@adobeforums.com in forum Adobe Illustrator Windows
    Replies: 10
    Last Post: August 31st, 05:39 PM
  2. Please HELP ME, this is impossible!!!
    By Aleksandar Ciric webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 2
    Last Post: August 25th, 08:37 AM
  3. Am I trying the impossible?
    By mickey in forum Macromedia Dreamweaver
    Replies: 3
    Last Post: August 1st, 01:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139