Cole Tierney

Q: command line utility to find standard directories

I'm looking for a command line utility that can print standard directories like:

/Library/Application Support

In objective-c I would use:

NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSLocalDomainMask, YES)

Posted on Dec 13, 2012 12:48 PM

Close

Q: command line utility to find standard directories

  • All replies
  • Helpful answers

Previous Page 2
  • by Cole Tierney,

    Cole Tierney Cole Tierney Dec 14, 2012 8:52 AM in response to etresoft
    Level 4 (1,375 points)
    Dec 14, 2012 8:52 AM in response to etresoft

    etresoft wrote:

    Just write it as a function in a .mm file and call it from C++. You could define it as a C function with "extern C" as well.

     

    Thanks, I'll give it a try.

  • by b_pascal,

    b_pascal b_pascal Jun 9, 2016 2:03 AM in response to Cole Tierney
    Level 1 (4 points)
    Jun 9, 2016 2:03 AM in response to Cole Tierney

    You can access the Cocoa-Framework from python, so a one-liner which you can use in a script would be:

     

    AppSupportDir=$(python -c "from Foundation import NSApplicationSupportDirectory, NSSearchPathForDirectoriesInDomains, NSLocalDomainMask;print NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSLocalDomainMask, True)[0] ")

Previous Page 2