Closed hadronized closed 7 years ago
Implemented but fails with hot-reloading.
Hot reloading partially fixed. The problem is that I use Path::canonicalize
to handle paths in a canonicalized way. Even though this is a nice solution, it won’t work with proxied resources because their paths might not exist (then there’s no way to canonicalize them).
The fix is actually pretty simple: upon creating the ResCache
, we have to canonicalize the root path (and prevent from creating a ResCache
if it doesn’t resolve to something that exists). Once we have that, we can use paths like data/splines/foo.json
: they always resolve to the same because we have the canonicalized version of data
, hence we can just append the relative path to the canonicalized one and end up on our feet.
Fixed. I need to rebase, squash and clean up all the commits, and then we’re done.
Fixed, I’ll release on crates.io as soon as possible.
I want a way to
get
a resource and if the loading fails, I still want to inject the resource in the cache by using a proxy resource. This is uber useful, especially when bootstrapping projects. You write the code without the data and you get proxies everywhere with a running application. You just have to create the files / modify the data to make the demo “pop out” of it! With the current implementation, if a resource fails to load at the firstget
, because weunwrap
the result, we get a panic and the application stops.The mechanism should be simple to work with. Maybe a new trait could work, like the following: