Professional Web Applications Themes

How to get application directory - Mac Programming

Hello all, My application uses some files that are in the same directory as the application. How can a get a path to this directory using carbon? By the way: can anyone tell me how to find such information. I only see a index of all funcitons, but how to search a function you do not the name of? Is there a search engine that you can tell to find something like "get application directory"? Thanks, Cor....

  1. #1

    Default How to get application directory

    Hello all,

    My application uses some files that are in the same directory as the
    application.
    How can a get a path to this directory using carbon?

    By the way: can anyone tell me how to find such information. I only see a
    index of all funcitons, but how to
    search a function you do not the name of?
    Is there a search engine that you can tell to find something like "get
    application directory"?

    Thanks, Cor.


    Cor Jansen Guest

  2. #2

    Default Re: How to get application directory

    In article <3f5d7ea6$0$58712$e4fe514cnews.xs4all.nl>,
    "Cor Jansen"
    <corjremoveThisPartIncludingTheUnderscores_dapdes ign.com> wrote:
    > My application uses some files that are in the same directory as the
    > application.
    > How can a get a path to this directory using carbon?
    I've traditionally done this by calling GetProcessInfo() on the
    currently running process.

    However, under OS X I usually end up using the various bundle calls
    because "the same directory as the application" doesn't always mean what
    you might wish it to mean.
    > By the way: can anyone tell me how to find such information. I only see a
    > index of all funcitons, but how to
    > search a function you do not the name of?
    > Is there a search engine that you can tell to find something like "get
    > application directory"?
    I decided to try to find out how to do this. It was very complex :-)

    I went to developer.apple.com and searched for "carbon get application
    directory" and found the following page as the first link:
    <[url]http://developer.apple.com/doentation/Performance/Conceptual/Performa[/url]
    nce/Carbon/Carbon_and__File_System.html>

    Look for "parent" on that page and you'll find the following code:
    // Get the currently running application's parent folder,
    // make it into an FSRef, and iterate it
    //
    outStatus = FSMakeFSSpec( 0, 0, "\p", &spec );
    if( outStatus == noErr )
    {
    outStatus = FSpMakeFSRef( &spec, &folderRef );
    if( outStatus == noErr )
    {
    outStatus = IterateFolder( &folderRef );
    }
    }

    So, there's another answer to your problem, along with how to find out
    information...
    Tom Dowdy Guest

  3. #3

    Default Re: How to get application directory

    In article <3f5d7ea6$0$58712$e4fe514cnews.xs4all.nl>,
    "Cor Jansen" <corjremoveThisPartIncludingTheUnderscores_dapdes ign.com> wrote:
    > My application uses some files that are in the same directory as the
    > application.
    > How can a get a path to this directory using carbon?
    GetProcessBundleLocation

    hth

    meeroh

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

    Miro Jurisic Guest

  4. #4

    Default Re: How to get application directory

    In article <3f5d7ea6$0$58712$e4fe514cnews.xs4all.nl>,
    "Cor Jansen"
    <corjremoveThisPartIncludingTheUnderscores_dapdes ign.com> wrote:
    > My application uses some files that are in the same directory as the
    > application.
    If possible, its better to put things in your application bundle's
    /Resources folder. What kind of files are they?
    Sean McBride Guest

  5. #5

    Default Re: How to get application directory

    "Cor Jansen" <corjremoveThisPartIncludingTheUnderscores_dapdes ign.com> wrote in message news:<3f5d7ea6$0$58712$e4fe514cnews.xs4all.nl>...
    > Hello all,
    >
    > My application uses some files that are in the same directory as the
    > application.
    > How can a get a path to this directory using carbon?
    From the one-liners:

    To find where your app is use GetProcessBundleLocation(GetCurrentProcess())
    Eric Pepke Guest

Similar Threads

  1. Can not support NAS or shared folder ? (Application Directory)
    By suil in forum Macromedia Flash Flashcom
    Replies: 0
    Last Post: May 24th, 12:43 PM
  2. Application Directory Parameter
    By Comgenie-com in forum Macromedia Flash Flashcom
    Replies: 3
    Last Post: October 5th, 07:31 PM
  3. Web Application, virtual directory
    By Fek in forum ASP.NET Web Services
    Replies: 0
    Last Post: April 5th, 03:11 PM
  4. Replies: 1
    Last Post: July 4th, 12:23 AM
  5. Replies: 1
    Last Post: May 21st, 03:47 PM

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