diff --git a/entrypoint.sh b/entrypoint.sh index 1a4c0c8..16fde76 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -56,7 +56,7 @@ if [ ! -z "$ADD_DATA_DIRS" ]; then # Process every directory in the ADD_DATA_DIRS string for dir in $ADD_DATA_DIRS; do # Add the formatted directory to the output string - ADD_DATA+="--add-data $SRCDIR/$dir:$dir " + ADD_DATA+="--add-data \"$SRCDIR/$dir;$dir\" " done # Remove the extra space at the end of the output string diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..f9d3390 --- /dev/null +++ b/test.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Fail on errors. +set -e + +SRCDIR=$1 + +DIRS=$2 + +# DIRS will receive a list of directories to be processed in +# the form of a string, e.g. "dir1 dir2/subdir2 file1.txt dir3/file3.txt" +# those can be separated by comas or newlines. +# the output need to be in the format: "--add-data $SRCDIR/$dir1/:dir1/" +# so that pyinstaller can process it correctly. +# the output will be in the form of a string, e.g. +# "--add-data /src/dir1/:dir1/ --add-data /src/dir2/subdir2/:dir2/subdir2/ --add-data /src/file1.txt:file1.txt" + +# A string de saída +OUTPUT="" + +# Verifica se DIRS está vazio ou não fornecido +if [ ! -z "$DIRS" ]; then + + # Processa cada diretório na string DIRS + for dir in $DIRS; do + # Adiciona o diretório formatado à string de saída + OUTPUT+="--add-data $SRCDIR/$dir:$dir " + done + # Remove o espaço extra no final da string de saída + OUTPUT=${OUTPUT::-1} +fi + + +# Imprime a string de saída +echo $OUTPUT \ No newline at end of file