• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: About path to temporary items.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About path to temporary items.


  • Subject: Re: About path to temporary items.
  • From: Yvan KOENIG <email@hidden>
  • Date: Mon, 17 Oct 2016 22:39:07 +0200


Le 17 oct. 2016 à 02:10, Shane Stanley <email@hidden> a écrit :

On 17 Oct. 2016, at 10:08 am, Jim Underwood <email@hidden> wrote:

By "the *true* temp folder", do you mean "/tmp" ?

No -- *true* was a poor choice of word. I didn't mean the standard Unix temp folder -- I meant the temp folder macOS uses. Using a fixed path for such things is regarded as a security risk, hence the use of paths like /private/var/folders/9d/n7rpchy88xlg3b008k8ydqlh0000gn/T/, where some of the components are randomized. (The security angle might well explain the change people are talking about.)

Cocoa has a function for retrieving this path -- NSTemporaryDirectory() -- and I believe it's always in the user domain. Using 'echo $TMPDIR' in Terminal returns the same thing.

use framework "Foundation"
current application's NSTemporaryDirectory() as text

AppleScript seems to be tacking on another component, TemporaryItems, presumably to reduce the risk of overwriting other apps' stuff.

Here's a more up-to-date article, although it too is a couple of years old (based on 10.9): <http://www.magnusviri.com/OS_X_Admin/what-is-var-folders.html>

--
Shane Stanley <email@hidden>


They don't return the same paths.

use AppleScript version "2.4"
use framework "Foundation"
use scripting additions
set PosixTemp to current application's NSTemporaryDirectory() as text
--> "/var/folders/v2/40_tdtj114gbn1fw4xts8hzh0000gn/T/"
set PosixTemp2 to POSIX path of (path to temporary items from user domain)
--> "/private/var/folders/v2/40_tdtj114gbn1fw4xts8hzh0000gn/T/TemporaryItems/"

As you may see, the first one doesn't include the "TemporaryItems" folder.



Yvan KOENIG running Sierra 10.12.0 in French (VALLAURIS, France) lundi 17 octobre 2016 22:37:48





 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: About path to temporary items.
      • From: Shane Stanley <email@hidden>
    • Re: About path to temporary items.
      • From: Deivy Petrescu <email@hidden>
References: 
 >About path to temporary items. (From: Yvan KOENIG <email@hidden>)
 >Re: About path to temporary items. (From: Shane Stanley <email@hidden>)
 >Re: About path to temporary items. (From: Jim Underwood <email@hidden>)
 >Re: About path to temporary items. (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: About path to temporary items.
  • Next by Date: Re: About path to temporary items.
  • Previous by thread: Re: About path to temporary items.
  • Next by thread: Re: About path to temporary items.
  • Index(es):
    • Date
    • Thread