Added edit_mh_config_from_gui function (dont rewrite edit_db_from_gui)
This commit is contained in:
@ -1037,17 +1037,32 @@ update_winetricks () {
|
|||||||
|
|
||||||
edit_db_from_gui () {
|
edit_db_from_gui () {
|
||||||
print_info "edit_db_from_gui PORTWINE_DB_FILE=$PORTWINE_DB_FILE"
|
print_info "edit_db_from_gui PORTWINE_DB_FILE=$PORTWINE_DB_FILE"
|
||||||
for mod_db in "$@" ; do
|
for mod_db in $@ ; do
|
||||||
print_info "${mod_db}=${!mod_db}"
|
print_info "${mod_db}=${!mod_db}"
|
||||||
escaped_value=$(printf "%s" "${!mod_db}" | sed 's/\\/\\\\/g; s/,/\\,/g')
|
if [ -z "`cat "${PORTWINE_DB_FILE}" | grep "export ${mod_db}="`" ] ; then
|
||||||
|
echo "export ${mod_db}=\"${!mod_db}\"" >> "${PORTWINE_DB_FILE}"
|
||||||
|
elif [ "`cat "${PORTWINE_DB_FILE}" | grep "export ${mod_db}=" | grep -v "#"`" ] ; then
|
||||||
|
if [ "`cat "${PORTWINE_DB_FILE}" | grep "export ${mod_db}=" | grep -v "#"`" != "export ${mod_db}=\"${!mod_db}\"" ] ; then
|
||||||
|
sed -ri "s/^export ${mod_db}=.*/export ${mod_db}=\"${!mod_db}\"/" "${PORTWINE_DB_FILE}"
|
||||||
|
fi
|
||||||
|
elif [ "`cat "${PORTWINE_DB_FILE}" | grep "export ${mod_db}="`" != "export ${mod_db}=${!mod_db}" ] ; then
|
||||||
|
sed -ri "s/.*export ${mod_db}=.*/export ${mod_db}=\"${!mod_db}\"/g" "${PORTWINE_DB_FILE}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
if [ -z "`grep "export ${mod_db}=" "${PORTWINE_DB_FILE}"`" ] ; then
|
edit_mh_config_from_gui () {
|
||||||
|
print_info "edit_mh_config_from_gui MANGOHUD_CONFIG=$MANGOHUD_CONFIG"
|
||||||
|
for mod_db in $@ ; do
|
||||||
|
escaped_value=$(printf "%s" "${!mod_db}" | sed 's/\\/\\\\/g; s/,/\\,/g')
|
||||||
|
if [ -z "`cat "${PORTWINE_DB_FILE}" | grep "export ${mod_db}="`" ] ; then
|
||||||
echo "export ${mod_db}=\"${escaped_value}\"" >> "${PORTWINE_DB_FILE}"
|
echo "export ${mod_db}=\"${escaped_value}\"" >> "${PORTWINE_DB_FILE}"
|
||||||
elif [ "`grep "export ${mod_db}=" "${PORTWINE_DB_FILE}" | grep -v "#"`" ] ; then
|
elif [ "`cat "${PORTWINE_DB_FILE}" | grep "export ${mod_db}=" | grep -v "#"`" ] ; then
|
||||||
if [ "`grep "export ${mod_db}=" "${PORTWINE_DB_FILE}" | grep -v "#"`" != "export ${mod_db}=\"${escaped_value}\"" ] ; then
|
if [ "`cat "${PORTWINE_DB_FILE}" | grep "export ${mod_db}=" | grep -v "#"`" != "export ${mod_db}=\"${escaped_value}\"" ] ; then
|
||||||
sed -ri "s/^export ${mod_db}=.*/export ${mod_db}=\"${escaped_value}\"/" "${PORTWINE_DB_FILE}"
|
sed -ri "s/^export ${mod_db}=.*/export ${mod_db}=\"${escaped_value}\"/" "${PORTWINE_DB_FILE}"
|
||||||
fi
|
fi
|
||||||
elif [ "`grep "export ${mod_db}=" "${PORTWINE_DB_FILE}"`" != "export ${mod_db}=${escaped_value}" ] ; then
|
elif [ "`cat "${PORTWINE_DB_FILE}" | grep "export ${mod_db}="`" != "export ${mod_db}=${escaped_value}" ] ; then
|
||||||
sed -ri "s/.*export ${mod_db}=.*/export ${mod_db}=\"${escaped_value}\"/g" "${PORTWINE_DB_FILE}"
|
sed -ri "s/.*export ${mod_db}=.*/export ${mod_db}=\"${escaped_value}\"/g" "${PORTWINE_DB_FILE}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -619,7 +619,8 @@ gui_MangoHud () {
|
|||||||
|
|
||||||
export MANGOHUD_CONFIG="${GUI_MH_RESULT}"
|
export MANGOHUD_CONFIG="${GUI_MH_RESULT}"
|
||||||
|
|
||||||
edit_db_from_gui MANGOHUD_CONFIG PW_MANGOHUD PW_FPS_LIMIT
|
edit_db_from_gui PW_MANGOHUD PW_FPS_LIMIT
|
||||||
|
edit_mh_config_from_gui MANGOHUD_CONFIG
|
||||||
/usr/bin/env bash -c "${pw_full_command_line[*]}" &
|
/usr/bin/env bash -c "${pw_full_command_line[*]}" &
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user