Skip to content

Commit acc6228

Browse files
committed
WIP detect 2019 modules
1 parent 197b61b commit acc6228

File tree

1 file changed

+37
-11
lines changed

1 file changed

+37
-11
lines changed

lib/u3d/installation.rb

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def do_not_move_file_path
105105
end
106106
end
107107

108-
class PlaybackEngineUtils
108+
class IvyPlaybackEngineUtils
109109
def self.list_module_configs(playbackengine_parent_path)
110110
Dir.glob("#{playbackengine_parent_path}/PlaybackEngines/*/ivy.xml")
111111
end
@@ -127,6 +127,22 @@ def self.unity_version(config_path)
127127
end
128128
end
129129

130+
# FIXME deprecated
131+
class PlaybackEngineUtils < IvyPlaybackEngineUtils
132+
end
133+
134+
class ModulePlaybackEngineUtils
135+
def self.list_module_configs(playbackengine_parent_path)
136+
# FIXME this is Mac specific
137+
Dir.glob("#{playbackengine_parent_path}/PlaybackEngines/*/modules.asset") |
138+
Dir.glob("#{playbackengine_parent_path}/Unity.app/Contents/PlaybackEngines/*/modules.asset")
139+
end
140+
141+
def self.module_name(config_path)
142+
File.basename(File.dirname(config_path)).gsub("Support", "")
143+
end
144+
end
145+
130146
class MacInstallation < Installation
131147
require 'plist'
132148

@@ -154,9 +170,13 @@ def path
154170

155171
def packages
156172
pack = []
157-
PlaybackEngineUtils.list_module_configs(root_path).each do |mpath|
158-
pack << PlaybackEngineUtils.module_name(mpath)
173+
IvyPlaybackEngineUtils.list_module_configs(root_path).each do |mpath|
174+
pack << IvyPlaybackEngineUtils.module_name(mpath)
175+
end
176+
ModulePlaybackEngineUtils.list_module_configs(root_path).each do |mpath|
177+
pack << ModulePlaybackEngineUtils.module_name(mpath)
159178
end
179+
160180
NOT_PLAYBACKENGINE_PACKAGES.each do |module_name|
161181
pack << module_name unless Dir[module_name_pattern(module_name)].empty?
162182
end
@@ -238,9 +258,9 @@ class LinuxInstallation < Installation
238258
def version
239259
# I don't find an easy way to extract the version on Linux
240260
path = "#{root_path}/Editor/Data/"
241-
package = PlaybackEngineUtils.list_module_configs(path).first
261+
package = IvyPlaybackEngineUtils.list_module_configs(path).first
242262
raise "Couldn't find a module under #{path}" unless package
243-
version = PlaybackEngineUtils.unity_version(package)
263+
version = IvyPlaybackEngineUtils.unity_version(package) # FIXME
244264
if (m = version.match(/^(.*)x(.*)Linux$/))
245265
version = "#{m[1]}#{m[2]}"
246266
end
@@ -267,8 +287,11 @@ def path
267287
def packages
268288
path = "#{root_path}/Editor/Data/"
269289
pack = []
270-
PlaybackEngineUtils.list_module_configs(path).each do |mpath|
271-
pack << PlaybackEngineUtils.module_name(mpath)
290+
IvyPlaybackEngineUtils.list_module_configs(path).each do |mpath|
291+
pack << IvyPlaybackEngineUtils.module_name(mpath)
292+
end
293+
ModulePlaybackEngineUtils.list_module_configs(root_path).each do |mpath|
294+
pack << ModulePlaybackEngineUtils.module_name(mpath)
272295
end
273296
NOT_PLAYBACKENGINE_PACKAGES.each do |module_name|
274297
pack << module_name unless Dir[module_name_pattern(module_name)].empty?
@@ -368,9 +391,9 @@ def version
368391
return version unless version.nil?
369392

370393
path = "#{root_path}/Editor/Data/"
371-
package = PlaybackEngineUtils.list_module_configs(path).first
394+
package = IvyPlaybackEngineUtils.list_module_configs(path).first
372395
raise "Couldn't find a module under #{path}" unless package
373-
PlaybackEngineUtils.unity_version(package)
396+
IvyPlaybackEngineUtils.unity_version(package)
374397
end
375398

376399
def build_number
@@ -403,8 +426,11 @@ def path
403426
def packages
404427
path = "#{root_path}/Editor/Data/"
405428
pack = []
406-
PlaybackEngineUtils.list_module_configs(path).each do |mpath|
407-
pack << PlaybackEngineUtils.module_name(mpath)
429+
IvyPlaybackEngineUtils.list_module_configs(path).each do |mpath|
430+
pack << IvyPlaybackEngineUtils.module_name(mpath)
431+
end
432+
ModulePlaybackEngineUtils.list_module_configs(root_path).each do |mpath|
433+
pack << ModulePlaybackEngineUtils.module_name(mpath)
408434
end
409435
NOT_PLAYBACKENGINE_PACKAGES.each do |module_name|
410436
pack << module_name unless Dir[module_name_pattern(module_name)].empty?

0 commit comments

Comments
 (0)