Module: Chef::Mixin::FileClass

Included in:
Provider::Link, Provider::RemoteDirectory
Defined in:
lib/chef/mixin/file_class.rb

Instance Method Summary collapse

Instance Method Details

#file_classObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/chef/mixin/file_class.rb', line 25

def file_class
  @host_os_file ||= if Chef::Platform.windows?
    require 'chef/win32/file'
    begin
      Chef::ReservedNames::Win32::File.verify_links_supported!
    rescue Chef::Exceptions::Win32APIFunctionNotImplemented => e
      message = "Link resource is not supported on this version of Windows"
      message << ": #{node[:kernel][:name]}" if node
      message << " (#{node[:platform_version]})" if node
      Chef::Log.fatal(message)
      raise e
    end
    Chef::ReservedNames::Win32::File
  else
    ::File
  end
end