|
2 | 2 | # frozen_string_literal: false
|
3 | 3 |
|
4 | 4 | require_relative '../jruby_art'
|
5 |
| - |
| 5 | +require_relative 'sketchbook' |
6 | 6 | # The processing wrapper module
|
7 | 7 | module Processing
|
8 | 8 | # Encapsulate library loader functionality as a class
|
9 | 9 | class LibraryLoader
|
10 | 10 | attr_reader :sketchbook_library_path
|
11 | 11 |
|
12 | 12 | def initialize
|
13 |
| - @sketchbook_library_path = File.join(find_sketchbook_path, 'libraries') |
| 13 | + @sketchbook_library_path = File.join(Sketchbook.find_path, 'libraries') |
14 | 14 | @loaded_libraries = Hash.new(false)
|
15 | 15 | end
|
16 | 16 |
|
@@ -117,27 +117,6 @@ def get_library_directory_path(library_name, extension = nil)
|
117 | 117 | end
|
118 | 118 | end
|
119 | 119 | nil
|
120 |
| - end |
121 |
| - |
122 |
| - def find_sketchbook_path |
123 |
| - preferences_paths = [] |
124 |
| - sketchbook_paths = [] |
125 |
| - sketchbook_path = Processing::RP_CONFIG.fetch('sketchbook_path', false) |
126 |
| - return sketchbook_path if sketchbook_path |
127 |
| - [ |
128 |
| - "'Application Data/Processing'", 'AppData/Roaming/Processing', |
129 |
| - 'Library/Processing', 'Documents/Processing', |
130 |
| - '.processing', 'sketchbook' |
131 |
| - ].each do |prefix| |
132 |
| - spath = format('%s/%s', ENV['HOME'], prefix) |
133 |
| - pref_path = format('%s/preferences.txt', spath) |
134 |
| - preferences_paths << pref_path if FileTest.file?(pref_path) |
135 |
| - sketchbook_paths << spath if FileTest.directory?(spath) |
136 |
| - end |
137 |
| - return sketchbook_paths.first if preferences_paths.empty? |
138 |
| - lines = IO.readlines(preferences_paths.first) |
139 |
| - matchedline = lines.grep(/^sketchbook/).first |
140 |
| - matchedline[/=(.+)/].delete('=') |
141 |
| - end |
| 120 | + end |
142 | 121 | end
|
143 | 122 | end
|
0 commit comments