Merge pull request #6012 from A1029384756/master

[tz_unix] added additional search paths to match musl
This commit is contained in:
Laytan
2025-12-15 19:06:16 +01:00
committed by GitHub

View File

@@ -81,9 +81,27 @@ _region_load :: proc(_reg_str: string, allocator := context.allocator) -> (out_r
}
defer if _reg_str == "local" { delete(reg_str, allocator) }
db_path := "/usr/share/zoneinfo"
region_path := filepath.join({db_path, reg_str}, allocator)
defer delete(region_path, allocator)
tzdir_str, tzdir_ok := os.lookup_env("TZDIR", allocator)
defer if tzdir_ok { delete(tzdir_str, allocator) }
return load_tzif_file(region_path, reg_str, allocator)
if tzdir_ok {
region_path := filepath.join({tzdir_str, reg_str}, allocator)
defer delete(region_path, allocator)
if tz_reg, ok := load_tzif_file(region_path, reg_str, allocator); ok {
return tz_reg, true
}
}
db_paths := []string{"/usr/share/zoneinfo", "/share/zoneinfo", "/etc/zoneinfo"}
for db_path in db_paths {
region_path := filepath.join({db_path, reg_str}, allocator)
defer delete(region_path, allocator)
if tz_reg, ok := load_tzif_file(region_path, reg_str, allocator); ok {
return tz_reg, true
}
}
return nil, false
}