Thiago Macieira wrote:

>> You're missing a detail. On OS X, $TMPDIR (and QDir::tempPath()) *are* user
>> specific. They're also very "immemorable"...
> 
> They're not required to be. If we can detect that they are, then sure, we
> could use it as XDG_RUNTIME_DIR.

>> > It could be a subdir of $TMPDIR, but then we run into a race condition
>> > problem of creating a secure subdir with a well-established name among
>> > applications. That's why the XDG spec says that XDG_RUNTIME_DIR *must*
>> > have been created when the user logs in and must be removed when the user
>> > fully logs out.

It sounds like all this is hard to enforce without checking before returning a 
location. NB: that's what KDE does with the directory that is supposed to act 
as ... the trashbin!

Note that OS X has NSString *NSTemporaryDirectory(), and also that QSP is 
already half set up to determine TempLocation via kTemporaryFolderType :


kTemporaryFolderType = 'temp', /* On Mac OS X, each user has their own 
temporary items folder, and the Folder Manager attempts to set permissions of 
these*/
                               /* folders such that other users can not access 
the data inside.  On Mac OS X 10.4 and later the data inside the temporary*/
                               /* items folder is deleted at logout and at 
boot, but not otherwise.  Earlier version of Mac OS X would delete items 
inside*/
                               /* the temporary items folder after a period of 
inaccess.  You can ask for a temporary item in a specific domain or on a */
                               /* particular volume by FSVolumeRefNum.  If you 
want a location for temporary items for a short time, then use either*/
                               /* ( kUserDomain, kkTemporaryFolderType ) or ( 
kSystemDomain, kTemporaryFolderType ).  The kUserDomain varient will always be*/
                               /* on the same volume as the user's home folder, 
while the kSystemDomain version will be on the same volume as /var/tmp/ ( and*/
                               /* will probably be on the local hard drive in 
case the user's home is a network volume ).  If you want a location for a 
temporary*/
                               /* file or folder to use for saving a document, 
especially if you want to use FSpExchangeFile() to implement a safe-save, then*/
                               /* ask for the temporary items folder on the 
same volume as the file you are safe saving.*/
                               /* However, be prepared for a failure to find a 
temporary folder in any domain or on any volume.  Some volumes may not have*/
                               /* a location for a temporary folder, or the 
permissions of the volume may be such that the Folder Manager can not return*/
                               /* a temporary folder for the volume.*/
                               /* If your application creates an item in a 
temporary items folder you should delete that item as soon as it is not 
needed,*/
                               /* and certainly before your application exits, 
since otherwise the item is consuming disk space until the user logs out or*/
                               /* restarts.  Any items left inside a temporary 
items folder should be moved into a folder inside the Trash folder on the disk*/
                               /* when the user logs in, inside a folder named 
"Recovered items", in case there is anything useful to the end user.*/

The only open question is what `macLocation` domain should be returned by 
QSP::TempLocation: kUserDomain, kSystemDomain or kOnAppropriateDisk .
Maybe Jake Petroules already addressed that question?

R.
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to