v0.x: the config directory takes the tool¶
A tool can declare that its user directory is $XDG_CONFIG_HOME/<tool>
(spec 0221).
The functions that resolved the directory from a name could not see that choice, so they take the tool instead. A tool
that declares nothing keeps ~/.<tool>.
What changes¶
setup.GetDefaultConfigDir(fs, name)is removed.setup.ConfigDir(tool)replaces it.- These take
tool props.Toolwhere they tookname string, in the same position:TimeSinceLast,GetTimeSinceLast,SetTimeSinceLast,SetCheckedVersion,GetCheckedVersionCanPin,SetPinnedVersion,GetPinnedVersion,SkipUpdateCheckIsProjectConfigTrusted,TrustProjectConfig,UntrustProjectConfig,ListTrustedProjectsEnsureDefaultConfigDir,CheckRotationRecord
props.ConfigSpecgainsDir, andprops.Newrefuses a value other than empty,props.ConfigDirHomeorprops.ConfigDirXDG.
What to do¶
- Replace
setup.GetDefaultConfigDir(p.FS, p.Tool.Name)withsetup.ConfigDir(p.Tool). - Replace
p.Tool.Namewithp.Toolin a call to a function listed above. - A generated project with a config initialiser (
with_initializer) fails to compile until itsinit.gomakes the first change.gtb regenerate projectwrites it, except in aninit.goyou have edited and kept, which you change by hand. The break is deliberate: an initialiser still naming the old directory would write a config an XDG tool never reads. - A tool that sets
Config.Dirafter it has released moves its users' files itself. One left behind matters more than the rest: withoutrotation.json, a release key revoked before the change is trusted again until a release carries a rotation manifest. doctorandupdatenow warn where a key rotation cannot be kept (setup.CanKeepRotationRecord), which is wherever the config directory is inside a git checkout, or cannot be resolved.