Skip to content

[flutter_tools] Use XDG_CONFIG_HOME dir by default for config files#66645

Merged
jonahwilliams merged 1 commit intoflutter:masterfrom
Jesse-Bakker:tool_xdg_base_dirs
Oct 3, 2020
Merged

[flutter_tools] Use XDG_CONFIG_HOME dir by default for config files#66645
jonahwilliams merged 1 commit intoflutter:masterfrom
Jesse-Bakker:tool_xdg_base_dirs

Conversation

@Jesse-Bakker
Copy link
Contributor

@Jesse-Bakker Jesse-Bakker commented Sep 25, 2020

Description

This PR changes the Config class in flutter_tools to use the XDG Base directory specification instead of putting files directly in the user's home directory. If those files are already present in the home directory, they are used instead.

Related Issues

fixes #59430

Tests

I added the following tests:

config_test.dart: Config in home dir, Config in config dir

Checklist

Before you create this PR, confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change. *

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Sep 25, 2020
@Jesse-Bakker Jesse-Bakker force-pushed the tool_xdg_base_dirs branch 2 times, most recently from bd51f2d to c230c50 Compare September 25, 2020 14:01
@Jesse-Bakker Jesse-Bakker changed the title Use XDG_CONFIG_HOME dir by default for config files [flutter_tools] Use XDG_CONFIG_HOME dir by default for config files Sep 26, 2020
@jonahwilliams jonahwilliams self-requested a review October 1, 2020 20:48
@Jesse-Bakker Jesse-Bakker force-pushed the tool_xdg_base_dirs branch 4 times, most recently from 3151990 to aecf881 Compare October 2, 2020 14:08
@Jesse-Bakker
Copy link
Contributor Author

Realized that the previous version would not work correctly on windows. Fixed, refactored and fixed requested changes.

@jonahwilliams
Copy link
Contributor

Can you also resolve the conflicting files?

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Thank you for the contribution @Jesse-Bakker !

@jonahwilliams jonahwilliams merged commit 60d7bb2 into flutter:master Oct 3, 2020
pberginkonsult added a commit to pberginkonsult/meta-flutter that referenced this pull request Jul 4, 2022
When building in a container environment without write
access to users home directory the build fails when 'flutter pub'
tries to install configuration into '$HOME/.config/flutter'.
This can be avoided by setting the variable 'XDG_CONFIG_HOME' that
'flutter' is using to decide where to install [1].

[1] flutter/flutter#66645

Signed-off-by: Peter Bergin <peter@berginkonsult.se>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support XDG Base Directory Specfication

3 participants