[Development] glib's and Qt's RuntimeLocation [OS X]

Thiago Macieira thiago.macieira at intel.com
Wed Nov 25 00:57:33 CET 2015

On Tuesday 24 November 2015 23:04:59 René J. V. Bertin wrote:
> Thiago Macieira wrote:
> > It mustn't be $TMPDIR. It needs to be a directory owned by the user so no
> 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.

But we need to detect as otherwise someone could set TMPDIR before starting 
the application.

> > 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.
> The former is true for $TMPDIR on OS X, but it is not deleted. The contents
> are wiped at reboot though, so the Unix fallback directory does get cleaned
> at that occasion.
> Do you have any idea what RuntimeLocation is used for on hosts that don't
> follow XDG principles (OS X, MS Windows) -- beyond what individual
> applications can decide evidently?

That's why QStandardPaths has a table in the documentation listing all 

For Windows, it's C:\Users\<USER> (i.e., $HOME); Blackberry is /var/tmp; 
Android has <APPROOT>/cache and it's not supported on iOS.

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

More information about the Development mailing list