Skip to content

Flutter Devtools create file in my $HOME and don't allow for relocation #7370

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

Open
bartekpacia opened this issue Mar 14, 2024 · 7 comments
Open
Labels
P3 issues we think are valid but not important server

Comments

@bartekpacia
Copy link
Member

bartekpacia commented Mar 14, 2024

In my home directory the following directory is created whenever I use devtools:

$ tree -a ~/.flutter-devtools
/Users/bartek/.flutter-devtools
└── .devtools

Content of that single file is:

$ cat ~/.flutter-devtools/.devtools
{
  "analyticsEnabled": true,
  "isFirstRun": false,
  "lastReleaseNotesVersion": "2.31.0",
  "2023-Q4": {
    "surveyActionTaken": false,
    "surveyShownCount": 0
  }
}

I don't like when programs clutter my personal ~. I very much echo sentiment of this article. Unfortunately it looks like the location of that file is currently hardcoded (example).

Therefore I'd like for Flutter DevTools to respect XDG Base Directory Specification, so that the .devtools file could be stored in (e.g.) ~/.local/state, that is, $XDG_STATE_HOME.

To support migration, Flutter Devtools would continue to use ~/.flutter-devtools/.devtools if it exists. If it does not exist, it should default to the appropriate XDG base directory.

I am willing to contribute this feature, if only the maintainers of this project agree with this suggestion.

@kenzieschmoll
Copy link
Member

My concern with changing the location of the .flutter-devtools/.devtools file is that it would not be consistent with what Flutter does for the .flutter file and the .flutter_tool_state file. These all live in the home directory:

Screenshot 2024-03-18 at 8 57 12 AM

@christopherfujino have there been any discussions around the location of the .flutter and .flutter_tool_state files WRT to not using the user's home directory? For DevTools, I think we should defer to the pattern that Flutter uses.

@bartekpacia
Copy link
Member Author

bartekpacia commented Mar 18, 2024

I'll risk a statement that Flutter is also doing the wrong thing with not respecting XDG Base Directory Specification – see flutter/flutter#59430. Ditto for Dart – see dart-lang/sdk#41560.

I had some spare time recently and spent it cleaning up my (sweet sweet) $HOME, and now I'm sad to say that the majority of unwanted files I have in my ~ right now come from either Flutter or Dart.

@christopherfujino
Copy link
Contributor

My concern with changing the location of the .flutter-devtools/.devtools file is that it would not be consistent with what Flutter does for the .flutter file and the .flutter_tool_state file. These all live in the home directory:

Screenshot 2024-03-18 at 8 57 12 AM

@christopherfujino have there been any discussions around the location of the .flutter and .flutter_tool_state files WRT to not using the user's home directory? For DevTools, I think we should defer to the pattern that Flutter uses.

not that I'm aware of. I'm not against changing this, if we could come into alignment. I would just add, however, that while XDG is a nice idea, my current debian installation doesn't have $XDG_STATE_HOME set. Also, my understanding is that Windows and macOS don't follow XDG at all. That is to say, this migration would principally be of benefit to those Linux users who happened to have $XDG_STATE_HOME set.

@bartekpacia
Copy link
Member Author

anecdotal argument: I am on macOS and chose to follow XDG (=set the env vars) to keep my home dir clean :-)

@christopherfujino
Copy link
Contributor

anecdotal argument: I am on macOS and chose to follow XDG (=set the env vars) to keep my home dir clean :-)

ok, but by that argument, we could name the variable $FOO_BAR and you would be happy, right?

@bartekpacia
Copy link
Member Author

bartekpacia commented Mar 19, 2024

yeah I guess?

Anyway

if we could come into alignment

I'm all for that. I guess backward compatibility is the main concern, right?

@bartekpacia
Copy link
Member Author

polite ping :)

  • an additional env var called e.g. FLUTTER_DEVTOOLS_STATE_HOME could be introduced into devtools, or
  • devtools could start respecting XDG_STATE_HOME

@elliette elliette added server P3 issues we think are valid but not important labels Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 issues we think are valid but not important server
Projects
None yet
Development

No branches or pull requests

4 participants