Professional Web Applications Themes

current directory - Mac Programming

Help! I am writing an application that can be lauched from either the Finder or from the command-line. I need to know the locations of two directories: 1) the directory that the executable is in 2) the current command-line directory I have figured out how to get (1), here is the code: FSRef processBundleDirectory; PSN currentProcess; GetCurrentProcess(&currentProcess); GetProcessBundleLocation(&currentProcess, &processBundleDirectory); I still can't figure out how to get (2). I know that the File Manager maintains a "default" volume and directory but this is not the same as the unix command-line "current" directory. How can I determine the current directory set ...

  1. #1

    Default current directory

    Help!

    I am writing an application that can be lauched from either the Finder
    or from the command-line. I need to know the locations of two
    directories:
    1) the directory that the executable is in
    2) the current command-line directory

    I have figured out how to get (1), here is the code:

    FSRef processBundleDirectory;
    PSN currentProcess;
    GetCurrentProcess(&currentProcess);
    GetProcessBundleLocation(&currentProcess, &processBundleDirectory);

    I still can't figure out how to get (2).
    I know that the File Manager maintains a "default" volume and
    directory but this is not the same as the unix command-line "current"
    directory.
    How can I determine the current directory set in the Terminal window
    that just executed the command-line?

    Thanks in advance,
    Mark
    Mark Guest

  2. #2

    Default Re: current directory

    On 25 Sep 2003, Mark wrote:
    > Help!
    >
    > I am writing an application that can be lauched from either the Finder
    > or from the command-line. I need to know the locations of two
    > directories:
    > 1) the directory that the executable is in
    > 2) the current command-line directory
    >
    > I have figured out how to get (1), here is the code:
    >
    > FSRef processBundleDirectory;
    > PSN currentProcess;
    > GetCurrentProcess(&currentProcess);
    > GetProcessBundleLocation(&currentProcess, &processBundleDirectory);
    >
    > I still can't figure out how to get (2).
    > I know that the File Manager maintains a "default" volume and
    > directory but this is not the same as the unix command-line "current"
    > directory.
    > How can I determine the current directory set in the Terminal window
    > that just executed the command-line?
    man getcwd ?

    Fred

    Frederick Cheung Guest

  3. #3

    Default Re: current directory

    In article <f8ef12cd.0309251538.4fbdeb86posting.google.com >,
    [email]mark.suskasympatico.ca[/email] (Mark) wrote:
    >I am writing an application that can be lauched from either the Finder
    >or from the command-line. I need to know the locations of two
    >directories:
    >1) the directory that the executable is in
    >2) the current command-line directory
    I don't think the Finder /has/ a current directory.
    It has no interaction with any command line. It doesn't
    concentrate on any particular directory. What would you
    want to do with that directory ?


    Simon Slavin Guest

Similar Threads

  1. -922 Cannot get name of current working directory
    By R. Poblete in forum Informix
    Replies: 0
    Last Post: November 9th, 12:17 AM
  2. #25846 [Bgs->Opn]: is_dir() does not work on any folder other than the current directory
    By notepad at codewalkers dot com in forum PHP Development
    Replies: 0
    Last Post: October 12th, 11:56 PM
  3. #25846 [NEW]: is_dir() does not work on any folder other than the current directory
    By notepad at codewalkers dot com in forum PHP Development
    Replies: 0
    Last Post: October 12th, 10:48 PM
  4. Finding current directory?
    By Sugapablo in forum ASP
    Replies: 1
    Last Post: October 3rd, 04:07 PM
  5. Replies: 2
    Last Post: August 7th, 11:22 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