mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 09:48:05 +03:00
3f33e9f3e9
Summary: The spec for both XDG and Mercurial say that when the XDG_CONFIG_HOME variable is not set, we should default to $HOME/.config. Windows and macOS also have a designated config folder outside of the home directory. The `dirs` crate provides consistent access to this folder. I see no harm in looking at config folders across all operating systems. Reviewed By: quark-zju Differential Revision: D14380686 fbshipit-source-id: 5e5a9cd4694aaa49fbc526f4917dc4afdaeb9842
21 lines
496 B
Perl
21 lines
496 B
Perl
#if no-windows no-osx
|
|
|
|
$ mkdir -p xdgconf/hg
|
|
$ echo '[ui]' > xdgconf/hg/hgrc
|
|
$ echo 'username = foobar' >> xdgconf/hg/hgrc
|
|
$ XDG_CONFIG_HOME="`pwd`/xdgconf" ; export XDG_CONFIG_HOME
|
|
$ unset HGRCPATH
|
|
$ hg config ui.username 2>/dev/null
|
|
foobar
|
|
|
|
$ mkdir -p home/.config/hg
|
|
$ echo '[ui]' > home/.config/hg/hgrc
|
|
$ echo 'username = bazbaz' >> home/.config/hg/hgrc
|
|
$ HOME="`pwd`/home" ; export HOME
|
|
$ unset XDG_CONFIG_HOME
|
|
$ hg config ui.username 2>/dev/null
|
|
bazbaz
|
|
|
|
|
|
#endif
|