# This is based on ripgrep: # https://github.com/BurntSushi/ripgrep/blob/master/cargo-out-dir #!/bin/bash # Finds Cargo's `OUT_DIR` directory from the most recent build. # # This requires one parameter corresponding to the target directory # to search for the build output. if [ $# != 1 ]; then echo "Usage: $(basename "$0") " >&2 exit 2 fi # This works by finding the most recent stamp file, which is produced by # every sc_extract build. target_dir="$1" find "$target_dir" -name sc_extract-stamp -print0 \ | xargs -0 ls -t \ | head -n1 \ | xargs dirname