Class: Nauvisian::Platform

Inherits:
Object
  • Object
show all
Defined in:
lib/nauvisian/platform.rb

Direct Known Subclasses

Linux, MacOS, Windows

Defined Under Namespace

Classes: Linux, MacOS, Windows

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.platformObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/nauvisian/platform.rb', line 8

def self.platform
  host_os = RbConfig::CONFIG["host_os"]
  case host_os
  when /\bdarwin\d*\b/
    MacOS.new
  when /\blinux\z/
    Linux.new
  when /\b(?:cygwin|mswin|mingw|bccwin|wince|emx)\b/
    Windows.new
  else
    raise UnsupportedPlatform, host_os
  end
end

Instance Method Details

#application_directoryObject



33
34
35
# File 'lib/nauvisian/platform.rb', line 33

def application_directory
  APPLICATON_DIRECTORIES.find(&:directory?)
end

#home_directoryObject



37
38
39
# File 'lib/nauvisian/platform.rb', line 37

def home_directory
  Pathname("~").expand_path.freeze
end

#mod_directoryObject



22
# File 'lib/nauvisian/platform.rb', line 22

def mod_directory = user_data_directory / "mods"

#save_directoryObject



24
# File 'lib/nauvisian/platform.rb', line 24

def save_directory = user_data_directory / "saves"

#script_output_directoryObject



26
# File 'lib/nauvisian/platform.rb', line 26

def script_output_directory = user_data_directory / "script-output"

#user_data_directoryObject

Returns the directory which holds user data

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/nauvisian/platform.rb', line 29

def user_data_directory
  raise NotImplementedError
end