forked from pop-os/cosmic-player
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
27 lines (25 loc) · 886 Bytes
/
Copy pathbuild.rs
File metadata and controls
27 lines (25 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use vergen::EmitBuilder;
use std::{env, fs, path::PathBuf};
use xdgen::{App, Context, FluentString};
fn main() {
EmitBuilder::builder().git_sha(true).emit().unwrap();
let id = "com.system76.CosmicPlayer";
let ctx = Context::new("i18n", env::var("CARGO_PKG_NAME").unwrap()).unwrap();
let app = App::new(FluentString("xdg-name"))
.comment(FluentString("xdg-comment"))
.keywords(FluentString("xdg-keywords"));
let output = PathBuf::from("target/xdgen");
fs::create_dir_all(&output).unwrap();
fs::write(
output.join(format!("{}.desktop", id)),
app.expand_desktop(format!("res/{}.desktop", id), &ctx)
.unwrap(),
)
.unwrap();
fs::write(
output.join(format!("{}.metainfo.xml", id)),
app.expand_metainfo(format!("res/{}.metainfo.xml", id), &ctx)
.unwrap(),
)
.unwrap();
}