From 1e05c6fe1785c60c2950c528ed13cef345bc3ae9 Mon Sep 17 00:00:00 2001 From: Michael Valdron Date: Wed, 15 May 2024 16:04:16 -0400 Subject: [PATCH] Allow samples cache directory to be created if non-existent (#239) * allow samplesDir to be created if non-existent Signed-off-by: Michael Valdron * address darwin relative path handling Signed-off-by: Michael Valdron * Update build-tools/cache_samples.sh Co-authored-by: Jordan Dubrick Signed-off-by: Michael Valdron --------- Signed-off-by: Michael Valdron Co-authored-by: Jordan Dubrick --- build-tools/cache_samples.sh | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/build-tools/cache_samples.sh b/build-tools/cache_samples.sh index 02cbdc5c4..f3d0fb384 100755 --- a/build-tools/cache_samples.sh +++ b/build-tools/cache_samples.sh @@ -99,11 +99,27 @@ function cache_devfile() { fi } -devfileEntriesFile=$1 -samplesDir=$2 +if [[ "$OSTYPE" == "darwin"* ]] +then + if [[ $1 != ./* ]] && [[ $1 != ../* ]] && [[ $1 != /* ]] + then + devfileEntriesFile=./$1 + else + devfileEntriesFile=$1 + fi + if [[ $2 != ./* ]] && [[ $2 != ../* ]] && [[ $2 != /* ]] + then + samplesDir=./$2 + else + samplesDir=$2 + fi +else + devfileEntriesFile=$1 + samplesDir=$2 +fi for sample in $(yq e '(.samples[].name)' $devfileEntriesFile); do - mkdir $samplesDir/$sample + mkdir -p $samplesDir/$sample echo $sample cache_sample $sample $samplesDir/$sample done \ No newline at end of file