colima icon indicating copy to clipboard operation
colima copied to clipboard

Create files and directories according to XDG spec

Open dudicoco opened this issue 11 months ago • 3 comments

Description

https://github.com/abiosoft/colima/discussions/1093#discussioncomment-11720708

The _lima and the daemon dirs and the docker sockets are currently created within the XDG_CONFIG_HOME dir. These contain log files, private keys and state, therefor they should be created in other XDG dirs according to the XDG spec: XDG_CACHE_HOME XDG_DATA_HOME XDG_STATE_HOME

Version

No response

Operating System

  • [X] macOS Intel <= 13 (Ventura)
  • [X] macOS Intel >= 14 (Sonoma)
  • [X] Apple Silicon <= 13 (Ventura)
  • [X] Apple Silicon >= 14 (Sonoma)
  • [X] Linux

Output of colima status

No response

Reproduction Steps

Expected behaviour

No response

Additional context

No response

dudicoco avatar Jan 12 '25 09:01 dudicoco

This is a solution.

However as colima only runs on macOS. Would it not make more sense to use macOS defined directories https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html#//apple_ref/doc/uid/TP40010672-CH10-SW1 (Noting that Containers here means something else)

So configs in ~/Library/Preferences images and containers in ~/Library/Caches or possibly for images ~/Library/Application Support

Anyway either XDG or Apple is better than current setup.

bestlem avatar Jan 12 '25 13:01 bestlem

@bestlem I don't believe it is better, I think we should follow the XDG standard since Colima already strives to follow that standard with its config file, and since the entire community strives to follow the XDG standard as well.

dudicoco avatar Jan 12 '25 15:01 dudicoco

Just to add, I've noticed that the trend with CLI apps, especially where user-facing config files are concerned, is to avoid placing such files in ~/Library, instead using typical dotfiles directories (even on macOS). For better or worse, this has resulted in some programs creating directories in the user's home folder, though there has been also been a clear trend toward respecting XDG variables and migrating these files out of $HOME.

pa-0 avatar Feb 15 '25 06:02 pa-0