From 4431cf4b291f2a746db94907bf95cd8d69ddb6b1 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 15 Jul 2014 16:16:35 -0400 Subject: [PATCH] optimize Runtime.default_paths slightly --- runtime/lib/runtime.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/runtime/lib/runtime.rb b/runtime/lib/runtime.rb index 736d8c1..ee96c2c 100644 --- a/runtime/lib/runtime.rb +++ b/runtime/lib/runtime.rb @@ -33,10 +33,13 @@ module Runtime # # @return [Array] Default runtime paths. def default_paths - [ - File.expand_path("~/.jes"), - File.expand_path("../../runtime", $0), - ] + paths = [] + user_path = File.expand_path("~/.jes") + if File.directory?(user_path) + paths << user_path + end + paths << File.expand_path("../../runtime", $0) + paths end # Find a runtime file within a single runtime path.