There is no temporary directory on Android

RESOLVED WONTFIX

Status

()

Core
Networking: File
RESOLVED WONTFIX
7 years ago
2 years ago

People

(Reporter: Yoric, Unassigned)

Tracking

({mobile})

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [necko-would-take])

By definition, there is no such thing as a temporary directory on Android. However, at the moment, GetSpecialSystemDirectory returns "/tmp", which is simply false.

Either GetSpecialSystemDirectory should fail on Android, or we should implement a notion of temporary directory by ourselves.
Turns out that I'm partially wrong. Thanks to GeckoAppShell monkey-patching TEMP, GetSpecialSystemDirectory returns an existing directory. However, this directory does not behave as a temporary directory, insofar as it is never cleaned-up.

I suggest the following mechanism:
- don't return Activity.getDir("tmp", ...) but Activity.getDir("tmp/randomuniquename", ...)
- store both that directory and Activity.getDir("tmp", ...)
- spawn a thread that, after a few seconds, starts progressively removing all other directories from "tmp".
Working on a patch.
wontfix?
Flags: needinfo?(dteller)
Whiteboard: [necko-would-take]
Yeah, let's.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Flags: needinfo?(dteller)
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.