/* * build.rs * * Copyright 2018-2024 Olivier Lecointre * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not see . * */ use std::env; use std::fs; use std::path::Path; use std::path::PathBuf; fn get_target_path() -> PathBuf { let _out_dir = env::var("OUT_DIR").unwrap(); let _path = Path::new(&_out_dir).join("../../../"); return PathBuf::from(_path); } fn main() { //let _out_dir = env::var("OUT_DIR").unwrap(); let target_dir = get_target_path(); let src = "/home/olivier/vdocs/Projects/rust/rustapp/emoticon.png";//Path::join(&env::current_dir().unwrap(), "/emoticon.png"); println!("Source {:?}",src); let dest = Path::join(Path::new(&target_dir), Path::new("emoticon.png")); println!("Dest {:?}",dest); fs::copy(src, dest).unwrap(); }