@@ -46,29 +46,39 @@ if [ -z "$URL" ]; then
4646fi
4747
4848echo " Downloading Processing.py for $OS ($ARCH )"
49- wget -O processing.py-archive " $URL " && tar -xvzf processing.py-archive -C " $TARGET_DIR "
49+ wget -O processing.py-archive " $URL "
5050
51- # Find the JAR file and rename it to processing-py.jar while moving it to the target directory
52- find " $TARGET_DIR " -name ' processing-py.jar ' -exec mv {} " $TARGET_DIR /processing-py.jar " \;
51+ # Create a temporary directory for extraction
52+ TEMP_DIR= $( mktemp -d )
5353
54- # Now, make the libraries available
55- # Assuming the libraries are directly under the extracted "libraries/processing/" directory
56- LIB_DIR=" $TARGET_DIR /libraries/processing/"
54+ # Extract the archive to the temporary directory
55+ tar -xvzf processing.py-archive -C " $TEMP_DIR "
5756
58- # Check if the libraries directory exists, then move it to the target directory
59- if [ -d " $LIB_DIR " ]; then
60- echo " Moving Processing libraries to the target directory"
61- # Move each library directory to the target directory
62- # If you prefer them in a specific subdirectory, adjust the target path accordingly
63- for lib in dxf io net opengl pdf serial video; do
64- if [ -d " $LIB_DIR /$lib " ]; then
65- mv " $LIB_DIR /$lib " " $TARGET_DIR /"
66- echo " Moved $lib library"
57+ # Find the top level processing.py-* directory
58+ BASE_DIR=$( find " $TEMP_DIR " -maxdepth 1 -type d -name ' processing.py-*' -print -quit)
59+
60+ if [ -n " $BASE_DIR " ]; then
61+ # Copy the processing-py.jar file to the target directory
62+ if [ -f " $BASE_DIR /processing-py.jar" ]; then
63+ cp " $BASE_DIR /processing-py.jar" " $TARGET_DIR /"
64+ fi
65+
66+ # Copy the contents of the libraries directory to $TARGET_DIR/libraries
67+ if [ -d " $BASE_DIR /libraries/processing" ]; then
68+ echo " Copying libraries from $BASE_DIR /libraries/processing/ to $TARGET_DIR /libraries/"
69+ # Ensure the target libraries directory exists
70+ mkdir -p " $TARGET_DIR /libraries"
71+ cp -r " $BASE_DIR /libraries/processing/." " $TARGET_DIR /libraries/"
6772 fi
68- done
73+ # log the contents of the $TARGET_DIR/libraries/ directory
74+ echo " Listing contents of $TARGET_DIR /libraries/:"
75+ ls -l " $TARGET_DIR /libraries/"
6976else
70- echo " Libraries directory not found: $LIB_DIR "
77+ echo " The expected top level directory was not found in the archive. "
7178fi
7279
80+ # Clean up: Remove the temporary directory
81+ rm -rf " $TEMP_DIR "
82+
7383echo " Listing contents of $TARGET_DIR :"
7484ls -l " $TARGET_DIR "
0 commit comments