Sha256: e52ced16fd98ca98a5c3226772f470a9632ec6f25106cbb0253317850d9873f3
Contents?: true
Size: 1.58 KB
Versions: 1
Compression:
Stored size: 1.58 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 = clean_path 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sprout-1.0.4.pre | lib/sprout/system/win_system.rb |