From b99807b77946cb08bfaa0bbd56a5f8906c371ede Mon Sep 17 00:00:00 2001 From: Rustam Vishnyakov Date: Wed, 21 Oct 2020 17:29:53 +0300 Subject: [PATCH] LightEdit mode launcher script fixes - More accurate required utilities diagnostics - Add "nosplash" argument GitOrigin-RevId: 4911806122ac80fe52ad60467a4d0137cddd7d94 --- .../resources/linux/scripts/ltedit.sh | 28 ++++++++++++++-- .../resources/mac/scripts/ltedit.sh | 33 +++++++++++++++++-- 2 files changed, 55 insertions(+), 6 deletions(-) diff --git a/platform/build-scripts/resources/linux/scripts/ltedit.sh b/platform/build-scripts/resources/linux/scripts/ltedit.sh index 396471c90877..28ee387cb00c 100644 --- a/platform/build-scripts/resources/linux/scripts/ltedit.sh +++ b/platform/build-scripts/resources/linux/scripts/ltedit.sh @@ -1,7 +1,29 @@ #!/bin/sh # ------------------------------------------------------ -# __product_full__ LightEdit mode script. +# __product_full__ LightEdit mode Linux script. # ------------------------------------------------------ +message() +{ + TITLE="Cannot start LightEdit mode script" + if [ -n "$(command -v notify-send)" ]; then + notify-send "ERROR: $TITLE" "$1" + else + printf "ERROR: %s\n%s\n" "$TITLE" "$1" + fi +} -IDE_BIN_HOME="$(dirname "$(realpath "$0")")" -exec "$IDE_BIN_HOME/__script_name__" -e "$@" \ No newline at end of file +DIRNAME=$(command -v dirname) +if [ -z "$DIRNAME" ]; then + message "Required 'dirname' utility is missing in the system." + exit 1 +fi + +REALPATH=$(command -v realpath) +if [ -z "$REALPATH" ]; then + message "Required 'realpath' utility is missing in the system." + exit 1 +fi + +IDE_BIN_HOME="$("$DIRNAME" "$("$REALPATH" "$0")")" + +exec "$IDE_BIN_HOME/__script_name__" nosplash -e "$@" \ No newline at end of file diff --git a/platform/build-scripts/resources/mac/scripts/ltedit.sh b/platform/build-scripts/resources/mac/scripts/ltedit.sh index 3799a079566a..9574945377cf 100644 --- a/platform/build-scripts/resources/mac/scripts/ltedit.sh +++ b/platform/build-scripts/resources/mac/scripts/ltedit.sh @@ -1,7 +1,34 @@ #!/bin/sh # ------------------------------------------------------ -# @@product_full@@ LightEdit mode script. +# @@product_full@@ LightEdit mode MacOS script. # ------------------------------------------------------ -IDE_BIN_HOME="${0%/*}" -exec "$IDE_BIN_HOME/../MacOS/@@script_name@@" -e "$@" \ No newline at end of file +message() { + TITLE="Cannot start LightEdit mode script" + if [ -n "$(command -v osascript)" ]; then + osascript -e 'display alert "'"$TITLE"'" message "'"$1"'" as critical' + else + printf "ERROR: %s\n%s\n" "$TITLE" "$1" + fi +} + +READLINK=$(command -v readlink) +if [ -z "$READLINK" ]; then + message "Required 'readlink' utility is missing in the system." + exit 1 +fi + +DIRNAME=$(command -v dirname) +if [ -z "$DIRNAME" ]; then + message "Required 'dirname' utility is missing in the system." + exit 1 +fi + +SCRIPT_LOC="$0" +while [ -L "$SCRIPT_LOC" ]; do + SCRIPT_LOC=$("$READLINK" "$SCRIPT_LOC") +done + +IDE_BIN_HOME=$("$DIRNAME" "$SCRIPT_LOC") + +exec "$IDE_BIN_HOME/../MacOS/@@script_name@@" nosplash -e "$@" \ No newline at end of file