How to get application directory

Ask a Question related to Mac Programming, Design and Development.

  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. Similar Questions and Discussions

    1. Please, Help me.. !! ((Can not support NAS or shared folder ? (Application Directory)))
      I need to set up application directory in NAS or Network Shared Folder. How can I do that ? In the fms.ini file. VHOST.APPSDIR = z:\myapps ...
    2. Application Directory Parameter
      I want to change the 'Application Directory' parameter of the SimpleConnect control using Actionscript. Maybe a dumb question... but how? This is...
    3. Web Application, virtual directory
      Hi, here the situation: My purpose is to have one physical directory(PD) (c:\webapplication) and a lot of virtual directory(VD) pointing to ...
    4. Server cannot access application directory ... The directory does not exist or is not accessible because of security settings
      If you are using Windows XP in a Workgroup, rather than a Domain, then by default "Simple Filesharing" is turned on, and you won't see a security...
    5. Server cannot access application directory... The directory does not exist or is not accessible because of security settings.
      Hi, I have this issue with the error below. Let me explain my goal and my server environement: Goal: To have 3 separate web servers reading...
  3. #2

    Default Re: How to get application directory

    In article <3f5d7ea6$0$58712$e4fe514c@news.xs4all.nl>,
    "Cor Jansen"
    <corj@removeThisPartIncludingTheUnderscores_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/documentation/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

  4. #3

    Default Re: How to get application directory

    In article <3f5d7ea6$0$58712$e4fe514c@news.xs4all.nl>,
    "Cor Jansen" <corj@removeThisPartIncludingTheUnderscores_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

  5. #4

    Default Re: How to get application directory

    In article <3f5d7ea6$0$58712$e4fe514c@news.xs4all.nl>,
    "Cor Jansen"
    <corj@removeThisPartIncludingTheUnderscores_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

  6. #5

    Default Re: How to get application directory

    "Cor Jansen" <corj@removeThisPartIncludingTheUnderscores_dapdes ign.com> wrote in message news:<3f5d7ea6$0$58712$e4fe514c@news.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

Posting Permissions

  • You may not post new threads
  • You may 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