File tree Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change 1010
1111libs=(
1212 " helperFunctions-lib"
13- " eventCallStack-lib"
1413 " ccClass-lib"
1514 " testSuite-lib"
1615)
@@ -23,20 +22,30 @@ targetFolderName=libs
2322
2423# fetch files.txt and save each file into the targetFolder
2524fetch () {
26-
2725 files_txt=$( curl -fsSL " https://raw.githubusercontent.com/$repo /$1 /$branch /files.txt" )
2826 if [ -z " $files_txt " ]; then
2927 echo " Could not load files.txt for $1 "
3028 exit 1
3129 fi
3230 while IFS= read -r FILE; do
33- rm -f $targetFolderName /$1 .lua # rm existing file
34- curl -s " https://raw.githubusercontent.com/$repo /$1 /$branch /$FILE " -o " $targetFolderName /$FILE "
31+ url=" https://raw.githubusercontent.com/$repo /$1 /$branch /$FILE "
32+
33+ mkdir -p " $( dirname " $targetFolderName /$FILE " ) " # create the folder (and subfolders specified in the files.txt)
34+ rm -f $targetFolderName /$FILE .lua # rm existing file
35+ if ! curl -s -o " $targetFolderName /$FILE " " $url " ; then
36+ echo " could not get / write the file $i : '$FILE ' to the folder '$targetFolderName '"
37+ exit 1
38+ fi
39+ # echo "saved $1: '$FILE' in '$targetFolderName'"
3540 done < <( echo " $files_txt " )
3641}
3742
38- mkdir -p $targetFolderName
39-
40- for i in " ${libs[@]} " ; do
41- fetch " $i "
42- done
43+ if [[ $# -eq 0 ]]; then
44+ # No arguments given, fetch all
45+ for i in " ${libs[@]} " ; do
46+ fetch " $i "
47+ done
48+ else
49+ # Argument given, fetch arguemt
50+ fetch " $1 "
51+ fi
You can’t perform that action at this time.
0 commit comments