You need to sign in or sign up before continuing.
Unverified Commit c08f0142 authored by Vladislav's avatar Vladislav Committed by Boris Yumankulov

Added numbering for duplicates and determining their uniqueness

parent 42dfd9c8
...@@ -1009,7 +1009,7 @@ stop_portwine () { ...@@ -1009,7 +1009,7 @@ stop_portwine () {
for dir in "${DESKTOP_DIRS[@]}" ; do for dir in "${DESKTOP_DIRS[@]}" ; do
while IFS= read -r -d '' link_file; do while IFS= read -r -d '' link_file; do
LINKS+=("$link_file") LINKS+=("$link_file")
done < <(find "$dir" -type f -iname "*.lnk" ${SHORTCUT_SKIP_LIST_NEW} -print0 2>/dev/null | sort -u) done < <(find "$dir" -type f -iname "*.lnk" -print0 2>/dev/null | sort -u)
done done
for link_file in "${LINKS[@]}"; do for link_file in "${LINKS[@]}"; do
...@@ -1048,7 +1048,7 @@ stop_portwine () { ...@@ -1048,7 +1048,7 @@ stop_portwine () {
else else
create_shortcut_from_link create_shortcut_from_link
if [[ "${SHORTCUT_DUBLICATE}" == "true" ]] ; then if [[ "${SHORTCUT_DUBLICATE}" == "true" ]] ; then
print_info "Created link for dublicate: $link_name - $prefix_name" print_info "Created link for dublicate: $link_name - $prefix_name [$number_dublication]"
else else
print_info "Created link for: $link_name" print_info "Created link for: $link_name"
fi fi
...@@ -1371,15 +1371,30 @@ create_shortcut_from_link () { ...@@ -1371,15 +1371,30 @@ create_shortcut_from_link () {
fi fi
fi fi
rm -f "${link_file}"
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
create_new_dir "${PORT_WINE_PATH}/dublicate" create_new_dir "${PORT_WINE_PATH}/dublicate"
PW_NAME_DESKTOP="${PORT_WINE_PATH}/dublicate/${PORTPROTON_NAME} - ${prefix_name}.desktop" SHORTCUT_DUBLICATE="true"
export SHORTCUT_DUBLICATE="true" number_dublication="1"
if [[ -f "${PORT_WINE_PATH}/dublicate/${PORTPROTON_NAME} - ${prefix_name} [$number_dublication].desktop" ]] ; then
number_dublication="$(ls "${PORT_WINE_PATH}/dublicate"/ 2>/dev/null)"
number_dublication="${number_dublication//*[/}"
number_dublication="${number_dublication//]*/}"
if ! grep -i "${exe_path}" "${PORT_WINE_PATH}/dublicate/${PORTPROTON_NAME} - ${prefix_name} [$number_dublication].desktop" &>/dev/null ; then
number_dublication="$(($number_dublication+1))"
else
exit 0
fi
fi
PW_NAME_DESKTOP="${PORT_WINE_PATH}/dublicate/${PORTPROTON_NAME} - ${prefix_name} [$number_dublication].desktop"
else
exit 0
fi
else else
PW_NAME_DESKTOP="${PORT_WINE_PATH}/${PORTPROTON_NAME}.desktop" PW_NAME_DESKTOP="${PORT_WINE_PATH}/${PORTPROTON_NAME}.desktop"
export SHORTCUT_DUBLICATE="" SHORTCUT_DUBLICATE=""
fi fi
rm -f "${link_file}"
echo "[Desktop Entry]" > "${PW_NAME_DESKTOP}" echo "[Desktop Entry]" > "${PW_NAME_DESKTOP}"
echo "Name=${PORTPROTON_NAME}" >> "${PW_NAME_DESKTOP}" echo "Name=${PORTPROTON_NAME}" >> "${PW_NAME_DESKTOP}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment