guardianproject / haven

Haven is for people who need a way to protect their personal spaces and possessions without compromising their own privacy, through an Android app and on-device sensors
https://guardianproject.github.io/haven/
GNU General Public License v3.0
6.58k stars 728 forks source link

Remove colons & use ISO8601-ish timestamps in files (Fixes #348 and #335) #351

Closed fat-tire closed 5 years ago

fat-tire commented 5 years ago

This hopefully will take care of @deviantollam's issues with the filenames.

I don't use straight ISO8601 because resolution is to the second, but it's possible multiple files (such as images) might be saved within a second. For that reason I've appended milliseconds as well. This actually fixes a separate bug where files are being saved with the same name.

Additionally, to keep weird things like "/.././" etc in directory names, plus spaces or other potential naming confusions, I've restricted the directory name in the settings to use only alphanumeric + the "/", "_", and "-" characters. This can be changed as a string resource for any other characters (such as with non-qwerty keyboards) or if people want emojis and such in their directory names. It's really meant to minimize confusion. (You can of course put spaces or anything but "/" in directory names in Linux, but in this case a "/" IS legit in case you want to put your directory somewhere...) Finally on this topic, the correct thing to do in Android would be to have the user select the directory via an File picker using the Storage Access Framework-- this could eliminate the requirement for the STORAGE READ/WRITE permission..

This has not been extensively tested, especially in real-world situations, so I'm hoping @deviantollam and others can give it a spin.

n8fr8 commented 5 years ago

Looking good... I changed the default path to "/haven".