Skip to content
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

feat: follow XDG spec on linux/mac and use windows known folders for config and logs #1153

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

kalvinnchau
Copy link
Collaborator

migrate to using etcetera to handle config/log/state files to follow XDG when on MacOS/Linux and use Windows known folders on windows

tl;dr table mapping changes for macos/linux

name new location old location changed?
config.yaml ~/.config/goose/config.yaml ~/.config/goose/config.yaml
sessions ~/.local/share/goose/sessions ~/.config/goose/sessions/
goose.log ~/.local/state/goose/logs/goose.log ~/.config/goose/logs/goose.log
goose-cli logs ~/.local/state/goose/logs/cli/* ~/.config/goose/logs/cli/*
goose-server logs ~/.local/state/goose/logs/server/* ~/.config/goose/logs/server/*
computer_controller ~/.cache/goose/computer_controller $HOME/Library/Caches
developer (goosehints) ~/.config/goose/.goosehints ~/.config/goose/.goosehints
memory ~/.config/goose/memory ~/.config/goose/memory
  • Use XDG_STATE_HOME for logs
    • "The $XDG_STATE_HOME contains state data that should persist between (application) restarts, but that is not important or portable enough to the user "
  • Use XDG_DATA_HOME for session files

Windows, where ~ == C:\Users\$USERNAME\:

name location
config.yaml ~\AppData\Roaming\Block\goose\config\config.yaml
sessions ~\AppData\Roaming\Block\goose\data\sessions\*
goose.log ~\AppData\Roaming\Block\goose\logs\data\goose.log
goose-cli logs ~\AppData\Roaming\Block\goose\data\logs\cli\*
goose-server logs ~\AppData\Roaming\Block\goose\data\logs\server\*
computer_controller ~\AppData\Local\Block\goose\cache\computer_controller\
developer (goosehints) ~\AppData\Roaming\Block\goose\config\.goosehints
memory ~\AppData\Roaming\Block\goose\config\memory

  • remove use dirs crate since it does not allow forcing the use of XDG on mac, and we want to keep XDG on mac
  • move most logging/state files out of ~/.config and into STATE/DATA dirs
  • Windows has no state_dir and we fallback to data_dir in that case
  • update once_cell to be the same version across all crates
  • make APP_STRATEGY static per crate, which allows us to rip out crates easier in the future
  • keep existing fallback /tmp/.config relative where it exists

resolves #1049

update comments to reflect path ouputs on various sytems
match existing behavior for defaults in computercontroller and memory
@kalvinnchau
Copy link
Collaborator Author

added support for legacy sessions at ~/.config/goose/sessions

  • it always checks the new location first ~/.local/share/goose/sessions, so in a name collision the new location wins
  • if resuming from an older session, it will re-write back to that same session path
  • resume from latest will only look in the legacy path if there are no sessions in the new path

@salman1993
Copy link
Collaborator

this looks great! we'll probably wanna rebase after merging #880 (the Windows PR has been waiting for some time)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consolidate configuration/logging locations
2 participants