From 8b4f0f91a9dfc0d85d5cf65d27d542cc8c359e55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 7 Jul 2019 13:27:37 +0300 Subject: [PATCH] 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. --- gst-plugin-version-helper/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gst-plugin-version-helper/src/lib.rs b/gst-plugin-version-helper/src/lib.rs index 5f252aa7..ce3af7e1 100644 --- a/gst-plugin-version-helper/src/lib.rs +++ b/gst-plugin-version-helper/src/lib.rs @@ -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