diff --git a/common/src/assets.rs b/common/src/assets.rs index 40cad4e8e6..5ddf97d0ba 100644 --- a/common/src/assets.rs +++ b/common/src/assets.rs @@ -205,6 +205,11 @@ lazy_static! { }; } +/// Returns the actual path of the specifier with the extension. +/// +/// For directories, give `""` as extension. +pub fn path_of(specifier: &str, ext: &str) -> PathBuf { ASSETS.source().path_of(specifier, ext) } + fn get_dir_files(files: &mut Vec, path: &Path, specifier: &str) -> io::Result<()> { for entry in fs::read_dir(path)? { if let Ok(entry) = entry { diff --git a/voxygen/src/i18n.rs b/voxygen/src/i18n.rs index 47756afe3e..62413bd316 100644 --- a/voxygen/src/i18n.rs +++ b/voxygen/src/i18n.rs @@ -251,7 +251,8 @@ impl assets::Compound for Localization { pub fn list_localizations() -> Vec { let mut languages = vec![]; // List language directories - for i18n_directory in std::fs::read_dir("assets/voxygen/i18n").unwrap() { + let i18n_root = assets::path_of("voxygen.i18n", ""); + for i18n_directory in std::fs::read_dir(&i18n_root).unwrap() { if let Ok(i18n_entry) = i18n_directory { if let Some(i18n_key) = i18n_entry.file_name().to_str() { // load the root file of all the subdirectories