solarus icon indicating copy to clipboard operation
solarus copied to clipboard

Solarus Launcher auto-add system-wide installed games

Open Nanolx opened this issue 8 years ago • 6 comments

What about auto-adding all games from

DATADIR/solarus/[game]

automatically to the launcher? Else all system-wide installed games won't appear by default.

Nanolx avatar Aug 11 '16 08:08 Nanolx

Good idea yes. There is no way to know a valid quests data directory for sure, but we can make guesses.

christopho avatar Aug 11 '16 09:08 christopho

This is what I personally use (for now) as wrapper script:

#!/bin/sh

config="${HOME}/.config/solarus/solarus.conf"

if [ ! -f "${config}" ]; then
	mkdir -p "$(dirname "${config}")"
	echo "[General]
last_quest=" >> "${config}"
fi

old_qp="$(awk -F= '/^quests_paths/{print $2}' "${config}")"
new_qp=""

for game in /usr/share/solarus/*; do
	new_qp="${game}, ${new_qp}"
done

merged_qp=$(echo "${old_qp}, ${new_qp}" | tr ' ' '\n' | sort -u | tr '\n' ' ')

sed '/^quests_paths/d' -i "${config}"
echo "quests_paths=${merged_qp}" >> "${config}"
sed -e 's/,[ \t]*$//' -i "${config}"

solarus.real "${@}"

/usr/bin/solarus is my wrapper script /usr/bin/solarus.real is the actual solarus launcher

there might be better ways to achieve that, but for me that's enough for now.

Nanolx avatar Jul 26 '17 19:07 Nanolx

As of right now, I am adding each quest that has a Debian package using the terminal switch in the package's install script.

If we wanted, we could put a "scan system directories" button that would add all quests in that directory at the user's request.

ekureina avatar Jul 27 '17 08:07 ekureina

See here, line 22: https://github.com/Nate-Devv/solarus-debian-source/blob/master/zsdx/debian/postinst

ekureina avatar Jul 27 '17 08:07 ekureina

I didn't know about the -add switch, fancy. Thanks.

Am 27. Juli 2017 10:12:39 MESZ schrieb Nathan Moore [email protected]:

See here, line 22: https://github.com/Nate-Devv/solarus-debian-source/blob/master/zsdx/debian/postinst

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/solarus-games/solarus/issues/964#issuecomment-318291545

-- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

Nanolx avatar Jul 27 '17 08:07 Nanolx

Yeah, that switch is relatively new.

ekureina avatar Jul 27 '17 09:07 ekureina