Module: Psdk::Cli::Studio
- Defined in:
- lib/psdk/helpers/studio.rb
Overview
Module holding all the logic about the Pokémon Studio
Class Method Summary collapse
-
.common_studio_location ⇒ Array<String>
Get all the common Pokemon Studio location.
-
.find_and_save_path(type) ⇒ Object
Find and Save Pokemon studio path.
-
.psdk_binaries_locations ⇒ Array<String>
Get all the psdk-binaries common location in Studio.
-
.psdk_binaries_path(path) ⇒ String | nil
Get the PSDK binary path based on Studio path.
-
.studio_app_data_location ⇒ String
Get the location of Studio in appdata.
Class Method Details
.common_studio_location ⇒ Array<String>
Get all the common Pokemon Studio location
39 40 41 42 43 44 45 46 47 |
# File 'lib/psdk/helpers/studio.rb', line 39 def common_studio_location volumes = Dir['/Volumes/**'] + Dir['/dev/sd*'] return [ '/Applications/PokemonStudio.app', *(ENV['AppData'] ? studio_app_data_location : nil), *volumes.map { |v| File.join(v, 'projects', 'PokemonStudio') }, 'C:/Projects/PokemonStudio' ] end |
.find_and_save_path(type) ⇒ Object
Find and Save Pokemon studio path
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/psdk/helpers/studio.rb', line 13 def find_and_save_path(type) locations = common_studio_location.select { |l| Dir.exist?(l) } binaries_locations = psdk_binaries_locations studio_path = locations.find { |l| binaries_locations.any? { |b| Dir.exist?(File.join(l, b)) } } unless studio_path puts '[Error] failed to locate Pokemon Studio, please set it up manually' exit(1) end puts "Located Pokemon Studio in `#{studio_path}`" Configuration.get(type).studio_path = studio_path Configuration.save end |
.psdk_binaries_locations ⇒ Array<String>
Get all the psdk-binaries common location in Studio
51 52 53 54 55 56 57 |
# File 'lib/psdk/helpers/studio.rb', line 51 def psdk_binaries_locations return [ 'psdk-binaries', 'Contents/Resources/psdk-binaries', 'resources/psdk-binaries' ] end |
.psdk_binaries_path(path) ⇒ String | nil
Get the PSDK binary path based on Studio path
30 31 32 33 34 35 |
# File 'lib/psdk/helpers/studio.rb', line 30 def psdk_binaries_path(path) valid_path = psdk_binaries_locations.find { |l| Dir.exist?(File.join(path, l)) } return nil unless valid_path return File.join(path, valid_path) end |
.studio_app_data_location ⇒ String
Get the location of Studio in appdata
61 62 63 |
# File 'lib/psdk/helpers/studio.rb', line 61 def studio_app_data_location return File.join(ENV.fetch('AppData', '.'), '../Local/Programs/pokemon-studio') end |