Skip to content

Commit

Permalink
Use Pathname to determine if path is absolute
Browse files Browse the repository at this point in the history
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
  • Loading branch information
azeey committed Apr 12, 2023
1 parent aa5f470 commit e6e7805
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cmd/cmdlaunch.rb.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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.
Expand Down

0 comments on commit e6e7805

Please sign in to comment.