Skip to content

Commit 2d4654a

Browse files
author
Fedor Finenko
committed
minor fixes in build.rs
1 parent 17472a5 commit 2d4654a

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

build.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use regex::Regex;
22
use std::collections::HashMap;
33
use std::env;
4-
use std::io::Write;
54
use std::error::Error;
6-
use std::fs::{self, File, create_dir_all, read_to_string};
5+
use std::fs::{self, create_dir_all, read_to_string, File};
76
use std::io::BufWriter;
7+
use std::io::Write;
88
use std::path::{Path, PathBuf};
99
use std::sync::LazyLock;
1010
use tera::{Context, Tera};
@@ -37,17 +37,12 @@ fn main() -> Result<(), Box<dyn Error>> {
3737

3838
for dir in locales_dir {
3939
let dir = dir?.path();
40-
let lang = dir
41-
.components()
42-
.last()
43-
.unwrap()
44-
.as_os_str()
45-
.to_str()
46-
.unwrap();
47-
create_dir_all(out_dir.join(lang)).unwrap();
40+
let lang = dir.components().last().unwrap();
41+
42+
let out_dir = out_dir.join(lang);
43+
create_dir_all(&out_dir).unwrap();
4844

49-
let mut out_file =
50-
BufWriter::new(File::create(out_dir.join(lang).join("onefetch.ftl"))?);
45+
let mut out_file = BufWriter::new(File::create(out_dir.join("onefetch.ftl"))?);
5146

5247
for ftl in dir.read_dir()? {
5348
let ftl = ftl?.path();

0 commit comments

Comments
 (0)