forked from CastroFidel/PortWINE
Merge branch 'fixed-for-autoshortcut' of github.com:Htylol/PortWINE into Htylol-fixed-for-autoshortcut
This commit is contained in:
commit
57af654d7a
@ -1341,6 +1341,7 @@ create_shortcut_from_link () {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
unset SHORTCUT_DUPLICATE SHORTCUT_ALREADY_CREATED
|
||||||
if [[ -f "${PORT_WINE_PATH}/${PORTPROTON_NAME}.desktop" ]] ; then
|
if [[ -f "${PORT_WINE_PATH}/${PORTPROTON_NAME}.desktop" ]] ; then
|
||||||
if ! grep -i "${exe_path}" "${PORT_WINE_PATH}/${PORTPROTON_NAME}.desktop" &>/dev/null ; then
|
if ! grep -i "${exe_path}" "${PORT_WINE_PATH}/${PORTPROTON_NAME}.desktop" &>/dev/null ; then
|
||||||
create_new_dir "${PORT_WINE_PATH}/duplicate"
|
create_new_dir "${PORT_WINE_PATH}/duplicate"
|
||||||
@ -1372,19 +1373,21 @@ create_shortcut_from_link () {
|
|||||||
fi
|
fi
|
||||||
number_duplication="$(("$number_duplication" + 1))"
|
number_duplication="$(("$number_duplication" + 1))"
|
||||||
else
|
else
|
||||||
exit 0
|
SHORTCUT_DUPLICATE="true"
|
||||||
|
SHORTCUT_ALREADY_CREATED="true"
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
number_duplication="1"
|
number_duplication="1"
|
||||||
fi
|
fi
|
||||||
PW_NAME_DESKTOP="${PORT_WINE_PATH}/duplicate/${PORTPROTON_NAME} - ${prefix_name} [$number_duplication].desktop"
|
|
||||||
SHORTCUT_DUPLICATE="true"
|
SHORTCUT_DUPLICATE="true"
|
||||||
|
PW_NAME_DESKTOP="${PORT_WINE_PATH}/duplicate/${PORTPROTON_NAME} - ${prefix_name} [$number_duplication].desktop"
|
||||||
else
|
else
|
||||||
exit 0
|
SHORTCUT_ALREADY_CREATED="true"
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
PW_NAME_DESKTOP="${PORT_WINE_PATH}/${PORTPROTON_NAME}.desktop"
|
PW_NAME_DESKTOP="${PORT_WINE_PATH}/${PORTPROTON_NAME}.desktop"
|
||||||
SHORTCUT_DUPLICATE=""
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[Desktop Entry]" > "${PW_NAME_DESKTOP}"
|
echo "[Desktop Entry]" > "${PW_NAME_DESKTOP}"
|
||||||
@ -1430,19 +1433,21 @@ export -f create_shortcut_from_link
|
|||||||
|
|
||||||
pw_auto_create_shortcut () {
|
pw_auto_create_shortcut () {
|
||||||
[[ "${PW_CHECK_AUTOINSTALL}" == 1 ]] && return 0
|
[[ "${PW_CHECK_AUTOINSTALL}" == 1 ]] && return 0
|
||||||
|
|
||||||
unset LINKS
|
unset LINKS
|
||||||
orig_IFS="$IFS" && IFS=$'\n'
|
for link_file in "${PORT_WINE_PATH}"/data/prefixes/*/drive_c/users/*/Desktop/*.lnk
|
||||||
for link_file in "${PORT_WINE_PATH}"/prefixes/*/drive_c/users/steamuser/Desktop/*.lnk
|
|
||||||
do
|
do
|
||||||
if echo "$link_file" | grep "\*.lnk" &>/dev/null
|
if ! echo "$link_file" | grep "\*.lnk" &>/dev/null ; then
|
||||||
then continue
|
link_file=$(readlink -f "${link_file}")
|
||||||
else LINKS+=("$link_file")
|
LINKS+=("${link_file// /@_@}")
|
||||||
|
else
|
||||||
|
continue
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
IFS="$orig_IFS"
|
|
||||||
[[ -z "$LINKS" ]] && return 0
|
[[ -z "$LINKS" ]] && return 0
|
||||||
|
SORTED_LINKS=($(echo ${LINKS[@]} | tr ' ' '\n' | sort -u))
|
||||||
|
|
||||||
for link_file in "${LINKS[@]}"; do
|
for link_file in "${SORTED_LINKS[@]//@_@/ }" ; do
|
||||||
if timeout 3 exiftool "$link_file" 2>/dev/null > "${PW_TMPFS_PATH}/exiftool.tmp" ; then
|
if timeout 3 exiftool "$link_file" 2>/dev/null > "${PW_TMPFS_PATH}/exiftool.tmp" ; then
|
||||||
prefix_name=$(echo "$link_file" | awk -F"/prefixes/" '{print $2}' | awk -F"/" '{print $1}')
|
prefix_name=$(echo "$link_file" | awk -F"/prefixes/" '{print $2}' | awk -F"/" '{print $1}')
|
||||||
if fix_icon_name=$(grep -i "Icon File Name" "${PW_TMPFS_PATH}/exiftool.tmp" 2>/dev/null) \
|
if fix_icon_name=$(grep -i "Icon File Name" "${PW_TMPFS_PATH}/exiftool.tmp" 2>/dev/null) \
|
||||||
@ -1477,15 +1482,23 @@ pw_auto_create_shortcut () {
|
|||||||
|
|
||||||
try_remove_file "$link_file"
|
try_remove_file "$link_file"
|
||||||
|
|
||||||
if ! exe_path="$(realpath "${link_path}")" ; then
|
if ! exe_path="$(realpath "${link_path}" 2>/dev/null)" ; then
|
||||||
print_warning "Removed broken link for: $link_name"
|
print_warning "Removed broken link for: $link_name"
|
||||||
else
|
else
|
||||||
if [[ "${SHORTCUT_DUPLICATE}" == "true" ]] ; then
|
|
||||||
print_info "Created link for duplicate: $link_name - $prefix_name [$number_duplication]"
|
|
||||||
else
|
|
||||||
print_info "Created link for: $link_name"
|
|
||||||
fi
|
|
||||||
create_shortcut_from_link
|
create_shortcut_from_link
|
||||||
|
if [[ "${SHORTCUT_DUPLICATE}" == "true" ]] ; then
|
||||||
|
if [[ "${SHORTCUT_ALREADY_CREATED}" == "true" ]] ; then
|
||||||
|
print_warning "There is already a shortcut with this path for duplicate: $link_name - $prefix_name"
|
||||||
|
else
|
||||||
|
print_info "Created link for duplicate: $link_name - $prefix_name [$number_duplication]"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ "${SHORTCUT_ALREADY_CREATED}" == "true" ]] ; then
|
||||||
|
print_warning "There is already a shortcut with this path for: $link_name"
|
||||||
|
else
|
||||||
|
print_info "Created link for: $link_name"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -2100,7 +2113,7 @@ start_portwine () {
|
|||||||
pw_wineboot -r
|
pw_wineboot -r
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
rm -f "${PORT_WINE_PATH}"/prefixes/*/drive_c/users/*/Desktop/*.lnk
|
rm -f "${PORT_WINE_PATH}"/data/prefixes/*/drive_c/users/*/Desktop/*.lnk
|
||||||
|
|
||||||
echo "${PW_WINE_USE}" > "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/.wine_ver"
|
echo "${PW_WINE_USE}" > "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/.wine_ver"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user