Skip to content

Fix Issue #1848: Medley script (and hence loadup script) now checks for lde (ldeinit) on PATH #2129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 29 additions & 18 deletions scripts/medley/medley.command
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ do
;;
--maikodir)
# for use in loadups
if [ "$2" = "-" ] || [ "$2" == "--" ]
if [ "$2" = "-" ] || [ "$2" = "--" ]
then
maikodir_arg=""
maikodir_stage=""
Expand Down Expand Up @@ -1360,34 +1360,45 @@ check_for_maiko_exe () {

if [ -z "${maikodir_arg}" ]
then
if check_for_maiko_exe "${MEDLEYDIR}/maiko"
then
maikodir_arg="${MEDLEYDIR}/maiko"
elif check_for_maiko_exe "${MEDLEYDIR}/../maiko"
# No MAIKODIR specified. But is lde (or ldeinit) on the PATH?
# If so, use it.
maiko_exe="$(command -v "${maikoprog_arg}")"
if [ -z "${maiko_exe}" ]
then
maikodir_arg="$(cd "${MEDLEYDIR}/../maiko"; pwd)"
else
if ! check_if_maiko_dir "${MEDLEYDIR}/maiko" && ! check_if_maiko_dir "${MEDLEYDIR}/../maiko"
# Lde (or ledinit) is not on the PATH, check in MEDLEYDIR/maiko and in MEDLEYDIR/../maiko
if check_for_maiko_exe "${MEDLEYDIR}/maiko"
then
err_msg="ERROR: Cannot find the Maiko directory at either
\"${MEDLEYDIR}/maiko\" or \"${MEDLEYDIR}/../maiko\".
maikodir_arg="${MEDLEYDIR}/maiko"
elif check_for_maiko_exe "${MEDLEYDIR}/../maiko"
then
maikodir_arg="$(cd "${MEDLEYDIR}/../maiko"; pwd)"
else
# Not in MEDLEYDIR/maiko and in MEDLEYDIR/../maiko, put out the appropriate error msg and exit
if ! check_if_maiko_dir "${MEDLEYDIR}/maiko" && ! check_if_maiko_dir "${MEDLEYDIR}/../maiko"
then
err_msg="ERROR: The maiko executable ($maikoprog_arg) is not on the PATH and cannot find
the Maiko directory at either \"${MEDLEYDIR}/maiko\"
or \"${MEDLEYDIR}/../maiko\".
You can use the --maikodir argument or the MAIKODIR env variable
to specify the Maiko directory.
Exiting."
output_error_msg "${err_msg}"
exit 53
else
err_msg="ERROR: Cannot find the Maiko executable (${maiko_exe_subdir}/${maikoprog_arg}) in either
\"${MEDLEYDIR}/maiko\" or \"${MEDLEYDIR}/../maiko\".
output_error_msg "${err_msg}"
exit 53
else
err_msg="ERROR: The maiko executable ($maikoprog_arg) is not on the PATH and cannot find
the Maiko executable (${maiko_exe_subdir}/${maikoprog_arg}) in either \"${MEDLEYDIR}/maiko\"
or \"${MEDLEYDIR}/../maiko\".
Exiting."
output_error_msg "${err_msg}"
exit 54
output_error_msg "${err_msg}"
exit 54
fi
fi
fi
elif ! check_if_maiko_dir "${maikodir_arg}" || ! check_for_maiko_exe "${maikodir_arg}"
then
# MAIKODIR is specified but lde (or ldeinit) is not in fact there. Error exit.
err_msg="In ${maikodir_stage}:
ERROR: The value provided by \$MAIKODIR or by the --maikodir argument ("${maikodir_arg}") is not
ERROR: The value provided by \$MAIKODIR or by the --maikodir argument (${maikodir_arg}) is not
in fact a directory containing the Maiko emulator (${maiko_exe_subdir}/${maikoprog_arg}).
Exiting."
output_error_msg "${err_msg}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/medley/medley_args.sh
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ do
;;
--maikodir)
# for use in loadups
if [ "$2" = "-" ] || [ "$2" == "--" ]
if [ "$2" = "-" ] || [ "$2" = "--" ]
then
maikodir_arg=""
maikodir_stage=""
Expand Down
45 changes: 28 additions & 17 deletions scripts/medley/medley_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -235,34 +235,45 @@ check_for_maiko_exe () {

if [ -z "${maikodir_arg}" ]
then
if check_for_maiko_exe "${MEDLEYDIR}/maiko"
# No MAIKODIR specified. But is lde (or ldeinit) on the PATH?
# If so, use it.
maiko_exe="$(command -v "${maikoprog_arg}")"
if [ -z "${maiko_exe}" ]
then
maikodir_arg="${MEDLEYDIR}/maiko"
elif check_for_maiko_exe "${MEDLEYDIR}/../maiko"
then
maikodir_arg="$(cd "${MEDLEYDIR}/../maiko"; pwd)"
else
if ! check_if_maiko_dir "${MEDLEYDIR}/maiko" && ! check_if_maiko_dir "${MEDLEYDIR}/../maiko"
# Lde (or ledinit) is not on the PATH, check in MEDLEYDIR/maiko and in MEDLEYDIR/../maiko
if check_for_maiko_exe "${MEDLEYDIR}/maiko"
then
maikodir_arg="${MEDLEYDIR}/maiko"
elif check_for_maiko_exe "${MEDLEYDIR}/../maiko"
then
err_msg="ERROR: Cannot find the Maiko directory at either
\"${MEDLEYDIR}/maiko\" or \"${MEDLEYDIR}/../maiko\".
maikodir_arg="$(cd "${MEDLEYDIR}/../maiko"; pwd)"
else
# Not in MEDLEYDIR/maiko and in MEDLEYDIR/../maiko, put out the appropriate error msg and exit
if ! check_if_maiko_dir "${MEDLEYDIR}/maiko" && ! check_if_maiko_dir "${MEDLEYDIR}/../maiko"
then
err_msg="ERROR: The maiko executable ($maikoprog_arg) is not on the PATH and cannot find
the Maiko directory at either \"${MEDLEYDIR}/maiko\"
or \"${MEDLEYDIR}/../maiko\".
You can use the --maikodir argument or the MAIKODIR env variable
to specify the Maiko directory.
Exiting."
output_error_msg "${err_msg}"
exit 53
else
err_msg="ERROR: Cannot find the Maiko executable (${maiko_exe_subdir}/${maikoprog_arg}) in either
\"${MEDLEYDIR}/maiko\" or \"${MEDLEYDIR}/../maiko\".
output_error_msg "${err_msg}"
exit 53
else
err_msg="ERROR: The maiko executable ($maikoprog_arg) is not on the PATH and cannot find
the Maiko executable (${maiko_exe_subdir}/${maikoprog_arg}) in either \"${MEDLEYDIR}/maiko\"
or \"${MEDLEYDIR}/../maiko\".
Exiting."
output_error_msg "${err_msg}"
exit 54
output_error_msg "${err_msg}"
exit 54
fi
fi
fi
elif ! check_if_maiko_dir "${maikodir_arg}" || ! check_for_maiko_exe "${maikodir_arg}"
then
# MAIKODIR is specified but lde (or ldeinit) is not in fact there. Error exit.
err_msg="In ${maikodir_stage}:
ERROR: The value provided by \$MAIKODIR or by the --maikodir argument ("${maikodir_arg}") is not
ERROR: The value provided by \$MAIKODIR or by the --maikodir argument (${maikodir_arg}) is not
in fact a directory containing the Maiko emulator (${maiko_exe_subdir}/${maikoprog_arg}).
Exiting."
output_error_msg "${err_msg}"
Expand Down