refactor: optimze path concatenation in get_lang()

This commit is contained in:
Ariq Pradipa Santoso 2023-04-04 01:08:34 +07:00
parent 78c2a8d0c8
commit 45ee8fbb23

View File

@ -6,9 +6,8 @@ pub async fn get_lang(window: tauri::Window, lang: String) -> String {
let lang = lang.to_lowercase();
// Send contents of language file back
let lang_path: PathBuf = [&install_location(), "lang", &format!("{}.json", lang)]
.iter()
.collect();
let lang_path = install_location().join("lang").join(format!("{}.json", lang));
match std::fs::read_to_string(lang_path) {
Ok(x) => x,
Err(e) => {