mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fix issue #1260: give a warning if an error occurs on language files load
This commit is contained in:
parent
e6ef678c28
commit
cae8005a18
@ -113,17 +113,25 @@ impl common_assets::Compound for Language {
|
||||
// Walk through files in the folder, collecting localization fragment to merge
|
||||
// inside the asked_localization
|
||||
let mut fragments = HashMap::new();
|
||||
for fragment_asset in cache
|
||||
for id in cache
|
||||
.load_dir::<RawFragment<String>>(asset_key, true)?
|
||||
.iter()
|
||||
.ids()
|
||||
{
|
||||
let id = fragment_asset.id();
|
||||
// don't try to load ._manifest files
|
||||
if id.ends_with("._manifest") {
|
||||
// Don't try to load manifests
|
||||
if id.ends_with(&[".", LANG_MANIFEST_FILE].concat()) {
|
||||
continue;
|
||||
}
|
||||
let read = fragment_asset.read();
|
||||
fragments.insert(PathBuf::from(id), read.clone());
|
||||
|
||||
match cache.load(id) {
|
||||
Ok(handle) => {
|
||||
let fragment: &RawFragment<String> = &*handle.read();
|
||||
|
||||
fragments.insert(PathBuf::from(id), fragment.clone());
|
||||
},
|
||||
Err(e) => {
|
||||
warn!("Unable to load asset {}, error={:?}", id, e);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Ok(Language::from(RawLanguage {
|
||||
|
Loading…
Reference in New Issue
Block a user