mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-29 07:03:54 +00:00
Update determine_time_zone according to GNU manual
This commit is contained in:
parent
13b91cced4
commit
57cf0f1b23
@ -292,9 +292,21 @@ impl Environment {
|
|||||||
|
|
||||||
fn determine_time_zone() -> TZResult<TimeZone> {
|
fn determine_time_zone() -> TZResult<TimeZone> {
|
||||||
if let Ok(file) = env::var("TZ") {
|
if let Ok(file) = env::var("TZ") {
|
||||||
TimeZone::from_file(format!("/usr/share/zoneinfo/{}", file))
|
TimeZone::from_file({
|
||||||
|
if file.starts_with("/") {
|
||||||
|
file
|
||||||
|
} else {
|
||||||
|
format!("/usr/share/zoneinfo/{}", {
|
||||||
|
if file.starts_with(":") {
|
||||||
|
// Unwrap is panic-free here because we've checked if file starts with colon
|
||||||
|
file.strip_prefix(":").unwrap()
|
||||||
|
} else {
|
||||||
|
file.as_str()
|
||||||
}
|
}
|
||||||
else {
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
TimeZone::from_file("/etc/localtime")
|
TimeZone::from_file("/etc/localtime")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user