From e6e7805810171f22ce267156f181c07c8396ef08 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Wed, 12 Apr 2023 10:41:03 -0500 Subject: [PATCH] Use Pathname to determine if path is absolute Signed-off-by: Addisu Z. Taddese --- src/cmd/cmdlaunch.rb.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cmd/cmdlaunch.rb.in b/src/cmd/cmdlaunch.rb.in index 6f28304e..a57abfa8 100755 --- a/src/cmd/cmdlaunch.rb.in +++ b/src/cmd/cmdlaunch.rb.in @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require 'pathname' # Constants. LIBRARY_VERSION = '@PROJECT_VERSION_FULL@' COMMANDS = { @@ -28,9 +29,8 @@ class Cmd command = args[0] exe_name = COMMANDS[command] - if exe_name[0] == '/' - # If the first character is a slash, we'll assume that we've been given an - # absolute path to the executable. This is only used during test mode. + if Pathname.new(exe_name).absolute? + # The exe_name can be absolute path during test. We'll leave it unchanged else # We're assuming that the library path is relative to the current # location of this script.