Skip to content

Commit 1e05c6f

Browse files
Allow samples cache directory to be created if non-existent (#239)
* allow samplesDir to be created if non-existent Signed-off-by: Michael Valdron <mvaldron@redhat.com> * address darwin relative path handling Signed-off-by: Michael Valdron <mvaldron@redhat.com> * Update build-tools/cache_samples.sh Co-authored-by: Jordan Dubrick <jdubrick@redhat.com> Signed-off-by: Michael Valdron <mvaldron@redhat.com> --------- Signed-off-by: Michael Valdron <mvaldron@redhat.com> Co-authored-by: Jordan Dubrick <jdubrick@redhat.com>
1 parent f77b0bf commit 1e05c6f

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

build-tools/cache_samples.sh

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,27 @@ function cache_devfile() {
9999
fi
100100
}
101101

102-
devfileEntriesFile=$1
103-
samplesDir=$2
102+
if [[ "$OSTYPE" == "darwin"* ]]
103+
then
104+
if [[ $1 != ./* ]] && [[ $1 != ../* ]] && [[ $1 != /* ]]
105+
then
106+
devfileEntriesFile=./$1
107+
else
108+
devfileEntriesFile=$1
109+
fi
110+
if [[ $2 != ./* ]] && [[ $2 != ../* ]] && [[ $2 != /* ]]
111+
then
112+
samplesDir=./$2
113+
else
114+
samplesDir=$2
115+
fi
116+
else
117+
devfileEntriesFile=$1
118+
samplesDir=$2
119+
fi
104120

105121
for sample in $(yq e '(.samples[].name)' $devfileEntriesFile); do
106-
mkdir $samplesDir/$sample
122+
mkdir -p $samplesDir/$sample
107123
echo $sample
108124
cache_sample $sample $samplesDir/$sample
109125
done

0 commit comments

Comments
 (0)