set asset path relative to root when loading sync (#643)
This commit is contained in:
parent
6f287fb815
commit
52a4d49bbf
@ -205,7 +205,7 @@ impl AssetServer {
|
|||||||
where
|
where
|
||||||
T: 'static,
|
T: 'static,
|
||||||
{
|
{
|
||||||
let path = path.as_ref();
|
let path = self.get_root_path()?.join(path);
|
||||||
if let Some(ref extension) = path.extension() {
|
if let Some(ref extension) = path.extension() {
|
||||||
if let Some(index) = self.extension_to_loader_index.get(
|
if let Some(index) = self.extension_to_loader_index.get(
|
||||||
extension
|
extension
|
||||||
@ -216,7 +216,7 @@ impl AssetServer {
|
|||||||
let handle_id = HandleId::new();
|
let handle_id = HandleId::new();
|
||||||
let resources = &self.loaders[*index];
|
let resources = &self.loaders[*index];
|
||||||
let loader = resources.get::<Box<dyn AssetLoader<T>>>().unwrap();
|
let loader = resources.get::<Box<dyn AssetLoader<T>>>().unwrap();
|
||||||
let asset = loader.load_from_file(path)?;
|
let asset = loader.load_from_file(path.as_ref())?;
|
||||||
let handle = Handle::from(handle_id);
|
let handle = Handle::from(handle_id);
|
||||||
|
|
||||||
assets.set(handle, asset);
|
assets.set(handle, asset);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user