Module: SkippyLib::Platform

Defined in:
modules/platform.rb

Overview

Since:

  • 3.0.0

Constant Summary collapse

POINTER_SIZE =

Since:

  • 3.0.0

['a'].pack('P').size * 8
KEY =

Since:

  • 3.0.0

(self.mac? ? 'win' : 'osx').freeze
ID =

Since:

  • 3.0.0

"#{KEY}#{POINTER_SIZE}"
NAME =

Since:

  • 3.0.0

(self.mac? ? 'macOS' : 'Windows').freeze
IS_MAC =

Since:

  • 3.0.0

self.mac?
IS_WIN =

Since:

  • 3.0.0

self.win?

Class Method Summary collapse

Class Method Details

.mac?Boolean

Returns:

  • (Boolean)

Since:

  • 3.0.0



8
9
10
# File 'modules/platform.rb', line 8

def self.mac?
  Sketchup.platform == :platform_osx
end

.temp_pathString

Returns:

  • (String)

Since:

  • 3.0.0



37
38
39
40
41
42
43
44
45
46
47
48
# File 'modules/platform.rb', line 37

def self.temp_path
  paths = [
    Sketchup.temp_dir,
    ENV['TMPDIR'],
    ENV['TMP'],
    ENV['TEMP'],
  ]
  temp = paths.find { |path| File.exist?(path) }
  raise 'Unable to locate temp directory' if temp.nil?

  File.expand_path(temp)
end

.win?Boolean

Returns:

  • (Boolean)

Since:

  • 3.0.0



13
14
15
# File 'modules/platform.rb', line 13

def self.win?
  Sketchup.platform == :platform_win
end