mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-27 05:51:01 +00:00
version-helper: Check first for a git repository in the manifest dir and only then one directory up
This allows using the crate also in git repositories that contain a single GStreamer plugin and not only in Cargo workspaces.
This commit is contained in:
parent
7e93c20b38
commit
50730574ba
1 changed files with 7 additions and 3 deletions
|
@ -8,13 +8,17 @@ pub fn get_info() {
|
|||
|
||||
let crate_dir = path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
let mut repo_dir = crate_dir.clone();
|
||||
repo_dir.pop();
|
||||
|
||||
// First check for a git repository in the manifest directory and if there
|
||||
// is none try one directory up in case we're in a Cargo workspace
|
||||
let repo = Repository::open(&repo_dir).or_else(move |_| {
|
||||
repo_dir.pop();
|
||||
Repository::open(&repo_dir)
|
||||
});
|
||||
|
||||
let mut release_file = crate_dir.clone();
|
||||
release_file.push("release.txt");
|
||||
|
||||
let repo = Repository::open(&repo_dir);
|
||||
|
||||
// If there is a git repository, extract the version information from there.
|
||||
// Otherwise use a 'release.txt' file as fallback, or report the current
|
||||
// date and an unknown revision.
|
||||
|
|
Loading…
Reference in a new issue