Skip to content

Conversation

@jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented Aug 5, 2022

I was sort of right, except it was a URI conversion. Without this change, when the tool calls setAssetDirectory, we would send a path like: /C:/Users/Tester/AppData/Local/Temp/hello_worldb42a6da5/hello_world/build/flutter_assets . While the forward slashes are OK, the leading slash causes the file path to be invalid according to the engine asset manager.

Background:

The purpose of calling setAssetDirectory is to provide a location where the application should load assets from ahead of the bundled assets. This goes through https://github.com/flutter/engine/blob/main/shell/common/shell.cc#L1760 which ultimately attempts to create a new asset resolver from the provided path here: https://github.com/flutter/engine/blob/main/shell/common/shell.cc#L1776-L1779

Unfortunately the behavior of PushFront/PushBack on the asset manager is to silently fail if the provided path is invalid. Thus we would continue using the old resolver. An entirely different code path re-sets the asset directory once we've done a hot restart, and that path is valid.

As a follow up, we should consider having the AssetManager return a signal as to whether adding the resolver was successful, and then plumb that data back into the response of setAssetDirectory to make any future breakages here easier to track down.

Fixes #108492

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Aug 5, 2022
Copy link
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

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

Nice find!

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 5, 2022
@auto-submit auto-submit bot merged commit f62da01 into flutter:master Aug 5, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 6, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Aug 6, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 6, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 6, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 7, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 7, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 8, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 8, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 8, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 8, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 8, 2022
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 tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flutter asset sync requires a hot restart on windows desktop

2 participants