version-helper: Take CARGO_MANIFEST_DIR at runtime, not at compile-time

Otherwise we'll always look at the directory of the version-helper crate
instead of the crate that is actually compiled.
This commit is contained in:
Sebastian Dröge 2019-07-07 13:27:37 +03:00
parent d0e5868880
commit 8b4f0f91a9

View file

@ -36,7 +36,7 @@
use chrono::TimeZone;
use git2::{Commit, ObjectType, Repository};
use std::{fs, path};
use std::{env, fs, path};
/// Extracts release for GStreamer plugin metadata
///
@ -77,7 +77,8 @@ pub fn get_info() {
let mut commit_id = "UNKNOWN".into();
let mut commit_date = chrono::Utc::now().format("%Y-%m-%d").to_string();
let crate_dir = path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let crate_dir =
path::PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set"));
let mut repo_dir = crate_dir.clone();
// First check for a git repository in the manifest directory and if there