Skip to content

Conversation

Jacalz
Copy link
Member

@Jacalz Jacalz commented Sep 30, 2025

Description:

This simplifies the logic for creating breadcrumbs a lot. Instead of doing a big allocation when splitting the path and then building the path again for each location, we can just go backwards and get the parent URI until we reach the root. Lastly, we just reverse the slice and boom, bob's your uncle. Also, move some logic around so we exit early. The new code is also less reliant on platform path conventions and can more easily handle non file:// URIs.

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

@Jacalz Jacalz changed the title Simplify breadcrumbs Simplify breadcrumbs generation in file dialog Sep 30, 2025
@Jacalz
Copy link
Member Author

Jacalz commented Sep 30, 2025

I don't know if it is just placebo but the file dialog does feel snappier :)

dialog/file.go Outdated
return err
}

isDir, err := storage.CanList(dir)
Copy link
Member

Choose a reason for hiding this comment

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

I don't know if it's related to the failures but this refactor seems to change behaviour.

This particular line won't add anything because the previous line got a lister, which will error if it cannot list.

I think this code came form inside a for loop so I'm not clear if it wasn't needed or if it was moved to the wrong location.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point about it not being relevant due to the line above. I don't think it should be needed in the for-loop. We can probably assume that paths higher up in the file system tree are listable and if they are not, we will get an error when we try to change to them. Given that we want to show all of the path up to where we are, I think that is fair.

But yeah, this is not related to the test failures. I think I am handling the volume name incorrectly.

@coveralls
Copy link

coveralls commented Oct 2, 2025

Coverage Status

coverage: 60.981% (-0.005%) from 60.986%
when pulling 73a93d9 on Jacalz:simplify-breadcrumbs
into e052430 on fyne-io:develop.

Jacalz added a commit to Jacalz/fyne that referenced this pull request Oct 13, 2025
Many thanks to @mbaklor for figuring this out.
Should unblock fyne-io#5958 failing Windows tests.
@Jacalz Jacalz requested a review from andydotxyz October 14, 2025 13:58
@Jacalz
Copy link
Member Author

Jacalz commented Oct 14, 2025

Windows tests are now passing after the .Name() method of URIs was fixed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants