OSX: handle subdir
OSX: use tmp file in localstorage