From 068d148eabf1d67f7dd5b3cb96ddfa750c54c5c4 Mon Sep 17 00:00:00 2001
From: Htylol <dixperm909@yandex.ru>
Date: Mon, 28 Oct 2024 06:17:05 +0500
Subject: [PATCH] optimization

---
 data_from_portwine/scripts/functions_helper | 37 +++++++++++----------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/data_from_portwine/scripts/functions_helper b/data_from_portwine/scripts/functions_helper
index eb183587..082081e9 100755
--- a/data_from_portwine/scripts/functions_helper
+++ b/data_from_portwine/scripts/functions_helper
@@ -870,28 +870,29 @@ search_desktop_file () {
                 done < "$desktop_file"
                 if [[ $portwine_exe == "${EXEC_DESKTOP//\"/}" ]] ; then
                     DESKTOP_CORRECT_FILE="$desktop_file"
-                fi
-                if [[ $DESKTOP_WITH_TIME == enabled ]] || [[ $SORT_WITH_TIME == enabled ]] ; then
-                    while IFS=" " read -r -a line2 ; do
-                        if [[ -z ${line2[0]} ]] \
-                        || [[ ! ${line2[0]} =~ (.[Bb][Aa][Tt]$|.[Ee][Xx][Ee]$|.[Mm][Ss][Ii]$|.[Rr][Ee][Gg]$) ]] ; then
-                            BROKEN_LINE=1
-                            break
-                        fi
-                        if [[ ${line2[1]} == "$FILE_SHA256SUM" ]] ; then
-                            FILE_SHA256SUM_FOUND=1
-                            break
-                        fi
-                        if [[ ${line2[1]} != "$FILE_SHA256SUM" ]] \
-                        && [[ ${line2[0]} == "${portwine_exe// /#@_@#}" ]] ; then
-                            FILE_SHA256SUM_NOT_FOUND=1
-                            break
-                        fi
-                    done < "$PORT_WINE_TMP_PATH/statistics"
+                    break
                 fi
             fi
         fi
     done
+    if [[ $DESKTOP_WITH_TIME == enabled ]] || [[ $SORT_WITH_TIME == enabled ]] ; then
+        while IFS=" " read -r -a line2 ; do
+            if [[ -z ${line2[0]} ]] \
+            || [[ ! ${line2[0]} =~ (.[Bb][Aa][Tt]$|.[Ee][Xx][Ee]$|.[Mm][Ss][Ii]$|.[Rr][Ee][Gg]$) ]] ; then
+                BROKEN_LINE=1
+                break
+            fi
+            if [[ ${line2[1]} == "$FILE_SHA256SUM" ]] ; then
+                FILE_SHA256SUM_FOUND=1
+                break
+            fi
+            if [[ ${line2[1]} != "$FILE_SHA256SUM" ]] \
+            && [[ ${line2[0]} == "${portwine_exe// /#@_@#}" ]] ; then
+                FILE_SHA256SUM_NOT_FOUND=1
+                break
+            fi
+        done < "$PORT_WINE_TMP_PATH/statistics"
+    fi
     IFS="$orig_IFS"
     if [[ $DESKTOP_WITH_TIME == enabled ]] || [[ $SORT_WITH_TIME == enabled ]] ; then
         local line3 line4 count_line i TIME_TOTAL SKIP_REPAIR