Sha256: 383b8219676a3836db7f5e4f653d67194dd28e134c9c0787c7bedb64bc259cdf
Contents?: true
Size: 1.57 KB
Versions: 4
Compression:
Stored size: 1.57 KB
Contents
module Sprout::System # The default Windows system. # This is the system type for all # major versions and flavors of Windows # (except Cygwin and Mingw). class WinSystem < BaseSystem LOCAL_SETTINGS = "Local\ Settings" APPLICATION_DATA = "Application\ Data" def home path = super if(path.include? "My Documents") path = File.dirname(path) end return path end def get_paths return env_path.split(';') end 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 def clean_path(path) path = path.split('/').join("\\") if(path.index(' ')) return %{"#{path}"} end return path end def format_application_name(name) return name.capitalize end def can_execute? platform [:windows, :win32].include?(platform) || super end protected ## # Gets the process runner and calls # platform-specific execute method def get_and_execute_process_runner tool, options=nil tool = find_tool tool runner = get_process_runner runner.execute_win32 "\"#{tool}\" #{options}" runner end private def find_tool tool return "#{tool}.bat" if File.exists?("#{tool}.bat") return "#{tool}.exe" if File.exists?("#{tool}.exe") tool end def env_path ENV['PATH'] end end end
Version data entries
4 entries across 4 versions & 1 rubygems