In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (John Delacour) 
wrote:

> Can someone please tell me if there's any reason not to write files 
> in /private/tmp rather than in /tmp/501/TemporaryItems ?
> 
> drwxrwxrwt   29 root  wheel   986 18 Jan 21:49 tmp
> drwxr-xr-x   13 jd    wheel   442 18 Jan 21:30 TemporaryItems
> 
> So far as jd and admin there's never been a problem, but would there 
> be a problem if I were a user with fewer privileges?

/tmp/501/TemporaryItems/ is your personal temporary items folder.  Witness:

$ perl -MMac::Files -le '
  print FindFolder(kOnSystemDisk, kTemporaryFolderType)'
/private/tmp/502/TemporaryItems

$ sudo -u maintenance perl -MMac::Files -le '
  print FindFolder(kOnSystemDisk, kTemporaryFolderType, kCreateFolder)'
/private/tmp/501/TemporaryItems

$ sudo -u guestuser perl -MMac::Files -le '
  print FindFolder(kOnSystemDisk, kTemporaryFolderType, kCreateFolder)'
/private/tmp/503/TemporaryItems


So when Mac apps use the standard Mac OS API to create temp files, that's 
the path they get, and if you want to restrict temp files to a particular 
user, then feel free to do the same.  Of course, you don't necessarily need 
to use Mac::Files and FindFolder, you can probably create the path yourself, 
though I wouldn't recommend that personally.

See man Mac::Files for details, or point your browser to:

  file:///Developer/Documentation/Carbon/Reference/Folder_Manager/index.html

See especially "FindFolder" under Functions, and "Folder Type Constants" and 
"Disk and Domain Constants" under Constants.

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to