Comments (8)
I honestly, it seems like it would be ideal if appdirs listened to XDG_*_HOME
for all operating systems.
Even if XDG isn't specified for macos, for almost all tools I can set (expecting it to work) XDG_CONFIG_HOME
, and therefore I can commit that dir to my dotfiles. Now, any library which uses appdirs forces me to go back to using symlinks and yields a worse experience.
In my mind, even if it doesn't make the most sense for someone to set it on windows, it at least gives everyone an opportunity to customize the config location, as opposed to unconditionally having it set to a specific location (but only on certain operating systems). And ultimately in the default case where it's not being set, you get the same existing behavior.
from appdirs.
@arusahni I expect @rendaw means doing so when it's configured as darwin if you want/need to e.g.
import appdirs
if appdirs.system == 'darwin':
appdirs.system = 'linux2'
if you want your application to follow XDG rules even on OSX.
from appdirs.
#137 seems like it'd be a jarring breaking change, on new installations it'd always prefer ~/.config
, hardcoded.
I'm imagining
def user_config_dir(appname=None, appauthor=None, version=None, roaming=False):
path = os.getenv('XDG_CONFIG_HOME')
if not path:
if system == "win32":
path = user_data_dir(appname, appauthor, None, roaming)
elif system == 'darwin':
path = os.path.expanduser('~/Library/Preferences/')
else:
path = os.path.expanduser("~/.config")
# win32's user_data_dir already appends appname
if appname and system != "win32":
path = os.path.join(path, appname)
if appname and version:
path = os.path.join(path, version)
return path
Given my understanding of the reasoning for the way it is right now (XDG is only a thing for linux), then this seems ideal to me:
- for people for whom that assumption is correct, they wont have
XDG_CONFIG_HOME
set and they'll see no change in behavior
** "Free" extra functionality for windows, where it's even less likely someone opts into thus, but hey i see no reason to artificially cripple windows. - for people like me, I'll see the behavior i want
Probably ideally this pattern is applied to all the xdg variables, but truly config is the only one that I'd actually like to commit to a repo, and therefore the only one there's a significant incentive to fix.
Happy to submit an actual PR if there's an indication it'd get merged.
from appdirs.
That looks like it'd apply that rule even when on Windows.
from appdirs.
Click does something similar for POSIX systems, although it doesn't try to infer the XDG_CONFIG_HOME
directory. Instead it just returns a top-level ~/.appname
dir for all platforms.
from appdirs.
Could you set appdirs.system
to linux2
maybe? https://github.com/ActiveState/appdirs/blob/master/appdirs.py#L39
from appdirs.
I guess I can take a stab at a PR re-enabling XDG_CONFIG_HOME
on Darwin next week.
E: #137 exists.
from appdirs.
Happy to submit an actual PR if there's an indication it'd get merged.
Unfortunately, we might have to wait for maintenance status to get sorted out in #79.
from appdirs.
Related Issues (20)
- Documentation examples for `user_config_dir` HOT 3
- Calls to appdirs functions fail on Jython in Windows if Java doesn't have JNA
- user_runtime_dir HOT 1
- user_config_dir vs Python from MS Store? HOT 1
- Getting write permission to site directories? HOT 4
- Breaking (and breaking pip) in MinGW Python running on Windows Server 2008 HOT 2
- Provide provide possibility to overwrite "user cache" location with env variable on linux HOT 3
- Startup path is not there
- App name is duplicated on Windows if author name is missing or None HOT 6
- pywintypes.com_error: "Can't find the specified path" on Windows
- Behavior inside a Flatpak sandbox?
- Add a note directing users to platformdirs HOT 3
- Does it support Android? HOT 1
- fix one-sentence summary in docstring for `site_config_dir`
- License parsing HOT 1
- feature: Support "well known" user directories HOT 1
- Branch names release vs. master
- macOS `user_config_dir` goes against OS guidelines
- Deprecate notice
- N
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from appdirs.