monich / harbour-foilauth

Secure OTP (One-Time Password) generator for Sailfish OS
https://openrepos.net/content/slava/foil-auth
Other
11 stars 6 forks source link

Your paths shoud obey the FDO standard, and put files under XDG_DOCUMENTS_DIR, not ~/Documents #9

Open progenyx opened 5 years ago

progenyx commented 5 years ago

That goes for all your apps.

Cheerio!

monich commented 5 years ago

AFAICT, XDG_DOCUMENTS_DIR isn't set for Sailfish OS apps. Besides, when those are tested for compliance with Jolla Store rules, testers insist that ~/Documents is the place where data files should be stored.

In any case it is what it is, and moving the files isn't worth the trouble at this point, I think.

And since foil.key file is shared by all Foil apps - that one certainly isn't going anywhere.

progenyx commented 5 years ago

Well, most apps, including Sailfish apps or more to the point, Jolla apps, obviously use the XDG user directories, because none of them has created a ~/Documents folder until now, but used the ones set by the user under ~/.config/user-dirs.dirs.

You should look into it more closely.

monich commented 5 years ago

Aha, I didn't know that we do have ~/.config/user-dirs.dirs on Sailfish OS. Anyway, it says XDG_DOCUMENTS_DIR="$HOME/Documents" so apparently I'm doing the right thing. It might make sense to use Qt or glib API to fetch that path instead of hardcoding it but functionally it won't change anything - data files will still go to ~/Documents.

progenyx commented 5 years ago

XDG_DOCUMENTS_DIR="$HOME/Documents" is just the default value, and it's in no way the recommended one -- most users I know change those values first chance they get. You're right, using Qt for that does make more sense, as it's probably the way Jolla does it for their apps as well. And data files should go to whatever folder the user has set for documents, don't you think. Why have two folders for documents when you don't need to, its an additional nuisance.

monich commented 5 years ago

~/Documents/FoilAuth is not a directory where a user is supposed to drop arbitrary files and expect something reasonable to happen. It's a representation of app's internal data model - it could be e.g. an sqlite database or a single file or whatever, it's just a format that I chose. One user, one app, one model, one representation in the internal storage. I don't see any reason to complicate that, really. It's not a desktop where you can start multiple instances of the app, open different files in each instance, etc.

ehdis commented 4 years ago

... It's a representation of app's internal data model ...

XDG_DOCUMENTS_DIR is a "well known" user directory (https://www.freedesktop.org/wiki/Software/xdg-user-dirs/) therefore to not be in the way of the user I suggest ~/.config/foilauth/ (https://www.freedesktop.org/software/systemd/man/file-hierarchy.html). Maybe foil/foil.key should be placed also there, thought ...