fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
24.67k stars 1.37k forks source link

Add time infos in the storage package #2233

Open SteeveDess opened 3 years ago

SteeveDess commented 3 years ago

I wanted to open the last image created in a folder. Andrew suggested to use storage and uri to be compatible cross platform. I tried, but I faced the reality, storage package don't give access to the creation et modification date/time. confirmed by Andrew. He asked to create an issue about it.

charlesdaniels commented 3 years ago

1665 is a good model of how this should be implemented, as this was the PR where we did most of the work for the current Repository system.

This would involve creating a new repository type in storage/repository, possibly something like TimableRepository, as well as the corresponding successor methods in storage. To implement this on file:// URIs, an implementation would need to be defined in internal/repository along with the other file:// repositories.

You can implement this now on your own if you want. You can just create your own repository type for file:// (the one in internal/repository may be a good start) which also implements your new time-handling methods in addition to the standard ones. A more detailed narrative description of how this works is here. As long as your repository complies with the necessary interfaces, Fyne's internal APIs will be happy to shuttle around your thus-augmented URIs, though of course it won't be aware of the additional methods.