-
Notifications
You must be signed in to change notification settings - Fork 412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respect XDG standards and don't put .pyfa in ~ by default #237
Comments
I'll take of look at this, but I'll be honest - if we were to adhere to this standard, it will probably be done with the next rewrite of pyfa. Might be too much of a hassle to ensure that user files are moved to the new location. Can you quickly explain how this is better than simply |
I'm not sure if python is resolving the ~ or if the OS is. Either way, Python can access This standard is better because I can (eventually) backup/link a single directory full of per-user program data and configuration instead of having it mixed into Edit: you can see my inexperience in the above example - should be: |
When i was writing a program recently I pondered about how to handle this problem of where to save the users data, and I cam across a python module called appdirs https://github.com/ActiveState/appdirs This gives you a single clean way of determining the standard save location for user data on all platforms. I do agree that it doesn't solve the problem of ensuring that the existing data is copied/moved across however. |
We will respect them in pyfa rewrite. Messing with existing user files might be risky. I do not want to spend any time on writing migration scripts for all platforms; however, i wholeheartedly agree it's a good thing and if someone implements it - it's going to be merged quickly. |
I'm interested in contributing, this looks like it'd be a good introductory task. Unfortunately I don't know much about the "base directory" spec and how prevalent it is. How commonly is the standard followed across different distros? Is adopting it an anti-pattern in some distros? @Iiridayn if you could contribute anything that'd be great. What would the behavior of the migration scripts look like? You could change the default config directory to I think the former solution of accepting both locations is ideal for the short-term. When the big "rewrite" release comes along that can bean excuse to permanently migrate any remaining |
I don't know either, thus i'd just check this variable and use it, unless it's empty (in which case pyfa should fall back to current home dir). On windows it should work reliably with CSIDL/KNOWNFOLDERID stuff. However when using knownfolderid one should double-check on older windows NT-based systems (XP) because they were introduced with Vista, iirc. On mac i have no idea. Like another ticket suggests, might use this for autodetection, just have to verify how it behaves under different conditions: https://github.com/ActiveState/appdirs |
I'd check if |
By default, line 54 of config.py is run, setting savePath to "~/.pyfa". Instead of forcing the use of ~ to store .pyfa, instead check the relevant XDG environment variable and store the data there instead. The location of .pyfa - though the . wouldn't be needed - would probably be $XDG_DATA_HOME - which defaults to "$HOME/.local/share" if undefined.
For more information please view http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html.
The text was updated successfully, but these errors were encountered: