Skip to content

Commit

Permalink
more tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
monkstone committed Feb 26, 2015
1 parent 06460d0 commit 5794f3b
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions lib/ruby-processing/library_loader.rb
Expand Up @@ -43,12 +43,10 @@ def load_ruby_library(library_name)
@loaded_libraries[library_name] = (require path)
end

# For pure java libraries, such as the ones that are available
# HACK: For pure java libraries, such as the ones that are available
# on this page: http://processing.org/reference/libraries/index.html
#
# P.S. -- Loading libraries which include native code needs to
# hack the 'Java ClassLoader', so that you don't have to
# futz with your PATH. But it's probably bad juju.
# that include native code, we mess with the 'Java ClassLoader', so that
# you don't have to futz with your PATH. But it's probably bad juju.
def load_java_library(library_name)
library_name = library_name.to_sym
return true if @loaded_libraries.include?(library_name)
Expand Down Expand Up @@ -80,7 +78,7 @@ def platform
end
return 'other' unless match
return match.downcase unless match =~ /Mac/
return 'macosx'
'macosx'
end

def get_platform_specific_library_paths(basename)
Expand All @@ -106,11 +104,10 @@ def get_library_directory_path(library_name, extension = nil)
extensions = extension ? [extension] : %w(jar rb)
extensions.each do |ext|
["#{SKETCH_ROOT}/library/#{library_name}",
"#{Processing::RP_CONFIG['PROCESSING_ROOT']}/modes/java/libraries/#{library_name}/library",
"#{RP5_ROOT}/library/#{library_name}/library",
"#{RP5_ROOT}/library/#{library_name}",
"#{@sketchbook_library_path}/#{library_name}/library",
"#{@sketchbook_library_path}/#{library_name}"
"#{Processing::RP_CONFIG['PROCESSING_ROOT']}/modes/java/libraries/#{library_name}/library",
"#{RP5_ROOT}/library/#{library_name}/library",
"#{RP5_ROOT}/library/#{library_name}",
"#{@sketchbook_library_path}/#{library_name}/library"
].each do |jpath|
return jpath if FileTest.exist?(jpath) && !Dir.glob(jpath + "/*.#{ext}").empty?
end
Expand All @@ -136,8 +133,7 @@ def find_sketchbook_path
regex2 = /^sketchbook\.path\.three=(.+)/ # processing-3.0
matched_lines = lines.grep(regex1) { $1 } unless $1 == ''
matched_lines = lines.grep(regex2) { $1 } unless $1 == ''
sketchbook_path = matched_lines.first
sketchbook_path
matched_lines.first
end
end
end

0 comments on commit 5794f3b

Please sign in to comment.