mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
embed strings.json into write_json.rs
It appears that including the build script as a dependency is not enough to make the file available at runtime, so the build breaks if ts/ is built first.
This commit is contained in:
parent
9aece2a7b8
commit
c697eb1086
1 changed files with 3 additions and 7 deletions
|
@ -1,16 +1,12 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use std::{
|
use std::{env, fs, path::Path};
|
||||||
env, fs,
|
|
||||||
path::{Path, PathBuf},
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let args: Vec<_> = env::args().collect();
|
let args: Vec<_> = env::args().collect();
|
||||||
let target_file = Path::new(args.get(1).expect("output path not provided"));
|
let target_file = Path::new(args.get(1).expect("output path not provided"));
|
||||||
|
let strings_json = include_str!(concat!(env!("OUT_DIR"), "/strings.json"));
|
||||||
|
|
||||||
let dir = PathBuf::from(env!("OUT_DIR"));
|
fs::write(target_file, strings_json).unwrap();
|
||||||
let path = dir.join("strings.json");
|
|
||||||
fs::copy(path, target_file).unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue