App/Build: Use env! macro to fetch the variable
env! is resolved at compile time which means we don't need to read and set LOCALDI from build.rs
This commit is contained in:
parent
0ae1eb9578
commit
15457e1db4
@ -14,20 +14,4 @@ fn main() {
|
||||
.current_dir("resources")
|
||||
.status()
|
||||
.unwrap();
|
||||
|
||||
// Generating build globals
|
||||
let default_locales = "./podcasts-gtk/po".to_string();
|
||||
let out_dir = env::var("OUT_DIR").unwrap();
|
||||
let localedir = env::var("PODCASTS_LOCALEDIR").unwrap_or(default_locales);
|
||||
let dest_path = Path::new(&out_dir).join("build_globals.rs");
|
||||
let mut f = File::create(&dest_path).unwrap();
|
||||
|
||||
let globals = format!(
|
||||
"
|
||||
pub(crate) static LOCALEDIR: &'static str = \"{}\";
|
||||
",
|
||||
localedir
|
||||
);
|
||||
|
||||
f.write_all(&globals.into_bytes()[..]).unwrap();
|
||||
}
|
||||
|
||||
@ -30,8 +30,6 @@ use i18n::i18n;
|
||||
|
||||
pub(crate) const APP_ID: &str = "org.gnome.Podcasts";
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/build_globals.rs"));
|
||||
|
||||
/// Creates an action named `name` in the action map `T with the handler `F`
|
||||
fn action<T, F>(thing: &T, name: &str, action: F)
|
||||
where
|
||||
@ -377,7 +375,7 @@ impl App {
|
||||
pub(crate) fn run() {
|
||||
// Set up the textdomain for gettext
|
||||
setlocale(LocaleCategory::LcAll, "");
|
||||
bindtextdomain("gnome-podcasts", LOCALEDIR);
|
||||
bindtextdomain("gnome-podcasts", env!("LOCALEDIR"));
|
||||
textdomain("gnome-podcasts");
|
||||
|
||||
let application = gtk::Application::new(APP_ID, gio::ApplicationFlags::empty())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user