Class: Sprout::System::WinSystem

Inherits:
BaseSystem show all
Defined in:
lib/sprout/system/win_system.rb

Overview

The default Windows system. This is the system type for all major versions and flavors of Windows (except Cygwin and Mingw).

Direct Known Subclasses

VistaSystem, WinNixSystem

Constant Summary

LOCAL_SETTINGS =
"Local\ Settings"
APPLICATION_DATA =
"Application\ Data"

Instance Method Summary (collapse)

Methods inherited from BaseSystem

#alt_separator?, #application_home, #env_home, #env_homedrive, #env_homedrive_and_homepath, #env_homepath, #env_userprofile, #execute, #execute_silent, #execute_thread, #find_home, #get_process_runner, #home=, #tilde_home, #worst_case_home

Instance Method Details

- (Boolean) can_execute?(platform)

Returns:

  • (Boolean)


46
47
48
# File 'lib/sprout/system/win_system.rb', line 46

def can_execute? platform
  [:windows, :win32].include?(platform) || super
end

- (Object) clean_path(path)



34
35
36
37
38
39
40
# File 'lib/sprout/system/win_system.rb', line 34

def clean_path(path)
  path = path.split('/').join("\\")
  if(path.index(' '))
    return %{"#{path}"}
  end
  return path
end

- (Object) format_application_name(name)



42
43
44
# File 'lib/sprout/system/win_system.rb', line 42

def format_application_name(name)
  return name.capitalize
end

- (Object) get_and_execute_process_runner(tool, options = nil) (protected)

Gets the process runner and calls platform-specific execute method



55
56
57
58
59
60
# File 'lib/sprout/system/win_system.rb', line 55

def get_and_execute_process_runner tool, options=nil
  tool = clean_path find_tool(tool)
  runner = get_process_runner
  runner.execute_win32 tool, options
  runner
end

- (Object) get_paths



20
21
22
# File 'lib/sprout/system/win_system.rb', line 20

def get_paths
  return env_path.split(';')
end

- (Object) home



12
13
14
15
16
17
18
# File 'lib/sprout/system/win_system.rb', line 12

def home
  path = super
  if(path.include? "My Documents")
    path = File.dirname(path)
  end
  return path
end

- (Object) library



24
25
26
27
28
29
30
31
32
# File 'lib/sprout/system/win_system.rb', line 24

def library
  # For some reason, my homepath returns inside 'My Documents'...
  application_data = File.join(home, LOCAL_SETTINGS, APPLICATION_DATA)
  if(File.exists?(application_data))
    return application_data
  else
    return super
  end
end