class Puppet::FileSystem::File19Windows

Public Instance Methods

chmod(mode, path) click to toggle source
# File lib/puppet/file_system/file19windows.rb, line 90
def chmod(mode, path)
  Puppet::Util::Windows::Security.set_mode(mode, path.to_s)
end
exist?(path) click to toggle source
# File lib/puppet/file_system/file19windows.rb, line 6
def exist?(path)
  if ! Puppet.features.manages_symlinks?
    return ::File.exist?(path)
  end

  path = path.to_str if path.respond_to?(:to_str) # support WatchedFile
  path = path.to_s # support String and Pathname

  begin
    if Puppet::Util::Windows::File.symlink?(path)
      path = Puppet::Util::Windows::File.readlink(path)
    end
    ! Puppet::Util::Windows::File.stat(path).nil?
  rescue # generally INVALID_HANDLE_VALUE which means 'file not found'
    false
  end
end
lstat(path) click to toggle source
# File lib/puppet/file_system/file19windows.rb, line 83
def lstat(path)
  if ! Puppet.features.manages_symlinks?
    return Puppet::Util::Windows::File.stat(path)
  end
  Puppet::Util::Windows::File.lstat(path)
end
read_preserve_line_endings(path) click to toggle source
# File lib/puppet/file_system/file19windows.rb, line 94
def read_preserve_line_endings(path)
  contents = path.read( :mode => 'rb', :encoding => Encoding::UTF_8)
  contents = path.read( :mode => 'rb', :encoding => Encoding::default_external) unless contents.valid_encoding?
  contents = path.read unless contents.valid_encoding?

  contents
end
stat(path) click to toggle source
# File lib/puppet/file_system/file19windows.rb, line 79
def stat(path)
  Puppet::Util::Windows::File.stat(path)
end