Sha256: 36af07ad6afc5daf550d016e2a74587ce3609cf827f9fa8e6fb209881c2aeb9c
Contents?: true
Size: 1.72 KB
Versions: 1
Compression:
Stored size: 1.72 KB
Contents
# frozen_string_literal: true require 'skippy/os/common' require 'skippy/sketchup/app' class Skippy::OSWin < Skippy::OSCommon # NOTE: This is not a good indication to 32bit bs 64bit. It's a naive # assumption that will fail when SketchUp is installed to a # non-standard location. SYSTEM_32BIT = ENV['ProgramFiles(x86)'].nil? && ENV['ProgramW6432'].nil? SYSTEM_64BIT = !SYSTEM_32BIT PROGRAM_FILES_64BIT = File.expand_path(ENV.fetch('ProgramW6432')) # @param [String] executable_path def launch_app(executable_path, *args) command = +%("#{executable_path}") unless args.empty? command << " #{args.join(' ')}" end execute_command(command) end def sketchup_apps # TODO(thomthom): Find by registry information. apps = [] program_files_paths.each { |program_files| pattern = "#{program_files}/{@Last Software,Google,SketchUp}/*SketchUp *" Dir.glob(pattern) { |path| exe = File.join(path, 'SketchUp.exe') debug_dll = File.join(path, 'SURubyDebugger.dll') version = sketchup_version_from_path(path) next unless version apps << Skippy::SketchUpApp.from_hash( executable: exe, version: version, can_debug: File.exist?(debug_dll), is64bit: SYSTEM_64BIT && path.start_with?("#{PROGRAM_FILES_64BIT}/") ) } } apps.sort_by(&:version) end private def program_files_paths paths = [] if SYSTEM_64BIT paths << File.expand_path(ENV.fetch('ProgramFiles(x86)')) paths << File.expand_path(ENV.fetch('ProgramW6432')) else paths << File.expand_path(ENV.fetch('ProgramFiles')) end paths end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
skippy-0.5.2.a | lib/skippy/os/win.rb |