Temporary Items folder doesn't exist

My app needs to generate a temporary file for a shell script to reference, so the logical choice was to point this file to “path to temporary items folder”. In Panther this works just fine; the temporary items folder is set to /private/var/tmp/501/TemporaryItems/. This directory seems to be persistant, or at least created by some other app on startup on every machine I’ve tested it on, so it will always be there for my app to access.

The trouble comes with Tiger. It’s temporary items folder is /private/var/tmp/folders.501/TemporaryItems/, not terribly different from Panther, except that /folders.501 and /TemporaryItems do not exist by default, causing an error when using “path to temporary items folder.”

Is there a way for /folders.501/TemporaryItems/ to be automatically created, or perhaps a more elegant way of going about this?

After a bit of testing I’ve discovered that the temporary items folder is automatically created in Panther, but not in Tiger. Is this a bug, or an intentional change in Applescript?

just use /tmp

It’s flushed on reboot.

Hmm… I’ll probably end up having to. Only reason I was using the temporary items special selector was for consistency - it seems that nearly all programs stash their temp files in TemporaryItems. I’m still curious what the problem is. It’s odd for this behavior to have changed so much between 10.3-10.4. Oh well, /tmp here I come.

Ahh…for me it seems they’re using /tmp

Stuffit, etc.

You can always do:

try
do shell script "mkdir /tmp/folders.501/TemporaryItems/"
on error
--probably means it already exists
end try

Not sure if it requires sudo or not…but running that when you run your script might help…

On my machine, Mac OS X 10.4.2, when I run the code, it seems to come back correctly, even immediately after a restart on an account with no login items:

path to temporary items
-->alias "Macintosh HD:private:var:tmp:folders.501:TemporaryItems:"

According to the StandardAdditions.osax: “[folder creation boolean] : Create the folder if it doesn’t exist? (default is true)”, just by asking for the path should automatically create the folder. If not on your machine, try explicitly using the folder creation parameter:

path to temporary items with folder creation

Jon