Class: Wixgem::Shortcut

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

Instance Method Summary collapse

Constructor Details

#initialize(file, hash) ⇒ Shortcut

Returns a new instance of Shortcut.



8
9
10
11
# File 'lib/shortcut.rb', line 8

def initialize(file, hash)
  @file = file
 @hash = hash
end

Instance Method Details

#create(xml_doc) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/shortcut.rb', line 13

def create(xml_doc)
 raise "Shortcut #{@file} does not exist" unless(File.exists?(@file))
	
 file_elements = REXML::XPath.match(xml_doc, "//File[@Source='.\\#{@file.gsub(/\//,'\\')}']")
 raise "Shortcut #{@file} does not match a 'File' element with a 'Source' attribute in the wix generated wix file" if(file_elements.length == 0)
 create_shortcut_element(file_elements[0])
 create_directory(xml_doc, @hash[:directory]) if(@hash.has_key?(:directory))
	
 return xml_doc
end