Direct-opening a temporary file using the user's preferred application
Jan Kundrát
jkt at flaska.net
Wed Apr 3 07:57:49 PDT 2013
On Wednesday, 3 April 2013 16:42:17 CEST, Rémi Denis-Courmont wrote:
> If the file is large, you should pass the URL to the application directly
> to avoid cluttering local storage and waiting almost forever while the
> whole file is downloaded, but obviously not all applications will support
> this.
Hi Remi, this is probably a good advice for common URL schemes like HTTP and for typical situations, but in the case of an IMAP e-mail client I believe that these no longer apply. The (invoking) application ships with a very efficient IMAP stack which I really want to use for the actual data transfer for obvious reasons. One cannot expect the stock image viewer to ship with a decent support for IMAP URLs, one shall not leak the user's credentials to random processes, the authentication mechanism might not be supported by the target application etc etc. There are also no existing standards for creating URLs to items in encrypted containers (think X.509 or GPG messages) etc.
In short, this question is about how to launch an appropriate application when I have the data somewhere on disk or in memory and know the corresponding MIME type.
> You definitely should not save it in /tmp as it might be mounted as
> tmpfs.
Thanks for correcting me, I'm actually not using a hardcoded /tmp but Qt's wrappers (which ultimately consult $TMPDIR with a fallback to /tmp). I've heard about Fedora (?) switching to tmpfs for /tmp before, but are you suggesting that applications shall no longer treat $TMPDIR as a place to store big temporary data?
Also, where is the cutoff point for "big" here?
> If you really want to delete the file automatically, the least problematic
> time to do so would be when your application exits. But it won't be
> perfect. Also keep in mind that your application or the system might crash,
> so this is not going to be reliable.
Yes, that's another alternative and it has its own share of disadvantages, as you point out. Are the other applications really leaving files behind? That looks like a wrong thing to do to me.
This makes me think that there should really be a way to do this better -- hence my question.
With kind regards,
Jan
--
Trojitá, a fast Qt IMAP e-mail client -- http://trojita.flaska.net/
More information about the xdg
mailing list