From 3e45f16cc51cc31ec75dbbbf3a701910e908a4e8 Mon Sep 17 00:00:00 2001
From: castro-fidel <tergoevm@gmail.com>
Date: Mon, 12 Oct 2020 21:53:14 +0300
Subject: [PATCH] Fix PATH_TO_GAMES

---
 data_from_portwine/scripts/create_shortcut | 2 +-
 data_from_portwine/scripts/portproton.sh   | 9 +++------
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/data_from_portwine/scripts/create_shortcut b/data_from_portwine/scripts/create_shortcut
index 3dbdc1b9..1c165078 100755
--- a/data_from_portwine/scripts/create_shortcut
+++ b/data_from_portwine/scripts/create_shortcut
@@ -7,7 +7,7 @@ if [ $? -eq 1 ];then exit 1; fi
 PORTPROTON_EXE=$(zenity --file-selection --file-filter=""*.exe" "*.bat"" \
 --title="${sc_path}" --filename="${PORT_WINE_PATH}/data/pfx/drive_c/")
 if [ $? -eq 1 ];then exit 1; fi
-PORTPROTON_PATH="$(dirname "$(readlink -f "${PORTPROTON_EXE}")")"
+PORTPROTON_PATH="$( cd "$( dirname "${PORTPROTON_EXE}" )" >/dev/null 2>&1 && pwd )" 
 if [ -x "`which wrestool 2>/dev/null`" ]; then
     wrestool -x --output="${PORT_WINE_PATH}/data/img/" -t14 "${PORTPROTON_EXE}"
 fi
diff --git a/data_from_portwine/scripts/portproton.sh b/data_from_portwine/scripts/portproton.sh
index 862ac3ea..2b09b468 100755
--- a/data_from_portwine/scripts/portproton.sh
+++ b/data_from_portwine/scripts/portproton.sh
@@ -3,18 +3,15 @@
 . "$(dirname $(readlink -f "$0"))/runlib"
 if [ -f "$1" ]; then
     export portwine_exe="$(readlink -f "$1")"
-    export PATH_TO_GAME="$(dirname $(readlink -f "$1"))"
+    export PATH_TO_GAME="$( cd "$( dirname "$1" )" >/dev/null 2>&1 && pwd )"
     START_PORTWINE
     if [ ! -z ${optirun_on} ]; then
         ${optirun_on} "${port_on_run}" "run" "$portwine_exe"
     else
         "${port_on_run}" "run" "$portwine_exe"
     fi
-    STOP_PORTWINE
 else
+    START_PORTWINE
     sh "${PORT_SCRIPTS_PATH}/winefile"
 fi
-
-
-
-
+STOP_PORTWINE