-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Store state files in $XDG_STATE_HOME by default #3185
base: master
Are you sure you want to change the base?
Store state files in $XDG_STATE_HOME by default #3185
Conversation
@JoeKar So far I only updated the docs. Please let me know if such changes make sense, so I can start implementing them. |
This isn't gonna be backwards compatible, is it? |
I was thinking about it, but in the initial proposal I decided to omit this. But I definitely would like to make this change completely painless for everyone. Making anyone lose time over such a minor change would be unprofessional. By "backward compatibility", do you mean that if Another option would be to copy |
Dunno. Neither option seems perfect. |
The backward compatibility will be a nasty thing.
In that case you will do this with every startup, right? Maybe it's better to move it then and maintain the new location only. 🤔 |
Yeah, it's also an option. The situation where the change I'm planning to make would cause problems seems very rare: Micro would have to crash, the user would have update in the meantime, and then the backup would be missing. |
Here is a patch to separate micro's state files from micro's config files. With this patch files that were previously searched for in This patch simply adds a config.StateDir variable (alongside the existing config.ConfigDir) and uses it for state stuff. The patch will create the state directory if it doesn't already exist but does not touch the old location. I don't do anything for migration because IMO it's not worth adding code that will sit in micro forever to address the minor one-time slight annoyance of history and cursor positions being reset. I think a small external migration script would be better for that (not included). If anyone would like to test this without the hassle of building micro from source a statically linked binary for 64-bit Linux (x86_64) can be found here. It should work on any x86_64 Linux distribution. A statically linked binary for 64-bit Arm Linux (aarch64) can be found here for those of you using 64 bit ARM servers or Pis. |
@clipcarl could you make the change as a Github pull request to make it easier to review? |
Honestly I've never used Github for development (I'm old-school) so I'm not sure how to do that! |
This PR is targeted at #3176