createapp integrate credits file

pull/103/head
Botspot 5 years ago
parent 35ce58a7d3
commit a2fdb64620

@ -28,9 +28,10 @@ while true;do
case $step in case $step in
1) 1)
echo "Welcome to the Create App wizard! echo "Welcome to the Create App wizard!
With a few simple steps, your project can take advantage of Pi-Apps"\'" features and be displayed in the application list." | yad --text-info --fontname=12 --wrap --show-uri \ With a few simple steps, your project can take advantage of Pi-Apps"\'" features and be displayed in the application list.
This wizard will save your work as you go." | yad --text-info --fontname=12 --wrap --show-uri \
--image="${DIRECTORY}/icons/in-progress.png" --image-on-top \ --image="${DIRECTORY}/icons/in-progress.png" --image-on-top \
--title="Create App Wizard" --window-icon="${DIRECTORY}/icons/logo.png" --center --width=310 --height=$windowheight \ --title="Create App Wizard" --window-icon="${DIRECTORY}/icons/logo.png" --center --width=310 --height=$((windowheight-100)) \
--button=Cancel!"${DIRECTORY}/icons/exit.png":1 \ --button=Cancel!"${DIRECTORY}/icons/exit.png":1 \
--button=Next!"${DIRECTORY}/icons/forward.png":0 || exit 0 --button=Next!"${DIRECTORY}/icons/forward.png":0 || exit 0
step=$((step+1)) step=$((step+1))
@ -69,13 +70,14 @@ With a few simple steps, your project can take advantage of Pi-Apps"\'" features
fi fi
output="$(yad --form \ output="$(yad --form \
--title="Create App: Step $step" --window-icon="${DIRECTORY}/icons/logo.png" --center --width=310 --height=$windowheight \ --title="Create App: Step $step" --window-icon="${DIRECTORY}/icons/logo.png" --center --width=310 --height=$((windowheight+200)) \
--text="Step ${step}: enter some information. The name field is mandatory." \ --text="Step ${step}: enter some information. The name field is mandatory." \
--field="Name of app:$([ ! -z "$namelocked" ]&&echo ':RO')" "$name" \ --field="Name of app:$([ ! -z "$namelocked" ]&&echo ':RO')" "$name" \
"$iconfield" "$iconpath" \ "$iconfield" "$iconpath" \
--field="Website:" "$(cat "${DIRECTORY}/apps/${name}/website" 2>/dev/null || echo '')" \ --field="Website:" "$(cat "${DIRECTORY}/apps/${name}/website" 2>/dev/null || echo '')" \
"$compatibilityentry" "$compatibilitypreset" \ "$compatibilityentry" "$compatibilitypreset" \
--field="Description:":TXT "$(cat "${DIRECTORY}/apps/${name}/description" || cat "${DIRECTORY}/apps/template/description")" \ --field="Description:":TXT "$(cat "${DIRECTORY}/apps/${name}/description" || cat "${DIRECTORY}/apps/template/description")" \
--field="Credits:":TXT "$(cat "${DIRECTORY}/apps/${name}/credits" || cat "${DIRECTORY}/apps/template/credits")" \
$([ ! -z $editing ]&&echo "--button=Save!${DIRECTORY}/icons/save.png:4") \ $([ ! -z $editing ]&&echo "--button=Save!${DIRECTORY}/icons/save.png:4") \
--button=Previous!"${DIRECTORY}/icons/back.png":2 \ --button=Previous!"${DIRECTORY}/icons/back.png":2 \
--button=Next!"${DIRECTORY}/icons/forward.png":0 \ --button=Next!"${DIRECTORY}/icons/forward.png":0 \
@ -93,6 +95,7 @@ With a few simple steps, your project can take advantage of Pi-Apps"\'" features
website="$(echo "$output" | sed -n '3p')" website="$(echo "$output" | sed -n '3p')"
compatibility="$(echo "$output" | sed -n '4p')" compatibility="$(echo "$output" | sed -n '4p')"
description="$(echo -e "$(echo "$output" | sed -n '5p')")" description="$(echo -e "$(echo "$output" | sed -n '5p')")"
credits="$(echo -e "$(echo "$output" | sed -n '6p')")"
#convert compatibility var into machine-readable #convert compatibility var into machine-readable
if [ "$compatibility" == "64bit and 32bit" ];then if [ "$compatibility" == "64bit and 32bit" ];then
@ -158,6 +161,15 @@ Install now?" \
echo "Created ${DIRECTORY}/apps/${name}/description" echo "Created ${DIRECTORY}/apps/${name}/description"
fi fi
#if credits field is populated
if [ ! -z "$credits" ];then
echo "$credits" > "${DIRECTORY}/apps/${name}/credits"
echo "Created ${DIRECTORY}/apps/${name}/credits"
elif [ -z "$credits" ] && [ -f "${DIRECTORY}/apps/${name}/credits" ] ;then
#clear credits if the user wanted them cleared.
echo '' > "${DIRECTORY}/apps/${name}/credits"
fi
step=$((step+1)) step=$((step+1))
else else
echo 'That app name already exists!' echo 'That app name already exists!'

Loading…
Cancel
Save