Skip to content

[path_provider] Add getApplicationCachePath() #4483

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

Merged
merged 27 commits into from
Aug 7, 2023

Conversation

jpnurmi
Copy link
Member

@jpnurmi jpnurmi commented Jul 16, 2023

Provides a suitable place for caching application-specific files on all supported platforms.

Platform Location
Android <app>/cache
iOS <app>/Library/Caches
Linux $XDG_CACHE_HOME/<app> or ~/.cache/<app>
macOS ~/Library/Caches/<app> or ~/Library/Containers/<app>/Data/Library/Caches/<app>
Windows %LOCALAPPDATA%/<app>

Fixes: flutter/flutter#105386

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

Thanks for implementing this! A few comments, but overall this looks excellent.

@jpnurmi jpnurmi marked this pull request as draft July 24, 2023 13:16
@jpnurmi jpnurmi marked this pull request as ready for review July 24, 2023 19:05
@jpnurmi
Copy link
Member Author

jpnurmi commented Aug 3, 2023

packages/rfw/example/wasm depends on:

  • wasm which depends on ffi ^1.0.0 and has been discontinued
  • path_provider_windows, which depends on ffi ^2.0.0
Running command: "flutter pub get" in /b/s/w/ir/x/w/packages/packages/rfw/example/wasm
Resolving dependencies...
Because every version of path_provider from path depends on path_provider_windows ^2.2.0 which depends on ffi ^2.0.0, every version of path_provider from path requires ffi ^2.0.0.
And because wasm >=0.1.0 depends on ffi ^1.0.0, path_provider from path is incompatible with wasm >=0.1.0.
So, because rfw_wasm depends on both wasm >=0.1.0+1 <=2.0.0 and path_provider from path, version solving failed.

@stuartmorgan-g
Copy link
Contributor

Hm, thanks for flagging that. I think this is fundamentally a repo tooling bug that's never been hit before, so I'll see if I can quickly fix that.

@stuartmorgan-g
Copy link
Contributor

Once #4647 lands, updating main in this PR should fix the failure. Sorry for the delay!

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

The change LGTM once the CI is passing.

auto-submit bot pushed a commit that referenced this pull request Aug 5, 2023
If adding a pathified dependency creates a resolver error, then skip it instead of failing when running pathified analysis. The purpose of pathified analysis it to pre-detect failures that would happen on publishing, and if there's a resolver error that means the publishing even won't affect the package anyway.

See #4483 (comment) for an example case where we need this.

(In theory we could get delayed OOB errors that this will miss�e.g., in the case above if the PR would actually break rfw/example/wasm, then if at some later date `wasm` updated to use a newer `ffi`, eliminating the resolver conflict, then suddenly rfw/example/wasm would pick up the PR and break. That seems *extremely* unlikely, however, so I'm not concerned that this will be a problem in practice. We can revisit if that changes.)
@jpnurmi jpnurmi marked this pull request as ready for review August 5, 2023 16:38
@jpnurmi
Copy link
Member Author

jpnurmi commented Aug 5, 2023

Thanks for #4647 and the reviews!

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 7, 2023
@auto-submit auto-submit bot merged commit 31b1849 into flutter:main Aug 7, 2023
@jpnurmi jpnurmi deleted the app-cache-path branch August 8, 2023 06:12
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 8, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Aug 8, 2023
flutter/packages@d7ee75a...ac41376

2023-08-08 engine-flutter-autoroll@skia.org Roll Flutter from ad0aa8d to 436df69 (17 revisions) (flutter/packages#4663)
2023-08-08 10687576+bparrishMines@users.noreply.github.com [webview_flutter_wkwebview] Repeatedly pump WebViews until one is garbage collected (flutter/packages#4662)
2023-08-08 erikgerman917@gmail.com [xdg_directories] Add example app (flutter/packages#4554)
2023-08-08 70025277+Nitin-Poojary@users.noreply.github.com [pigeon] Recursively create output target files (flutter/packages#4458)
2023-08-07 jpnurmi@gmail.com [path_provider] Add getApplicationCachePath() (flutter/packages#4483)
2023-08-07 10687576+bparrishMines@users.noreply.github.com [flutter_markdown] Adopt code excerpts in README (flutter/packages#4656)
2023-08-07 reidbaker@google.com [All] Expand artifact hub to all plugins (flutter/packages#4645)
2023-08-07 engine-flutter-autoroll@skia.org Roll Flutter from 2ba9f7b to ad0aa8d (31 revisions) (flutter/packages#4659)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: path_provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[path_provider] A way to get the current user's cache directory on desktop
2 participants