Sha256: bbe754b1157b255ac6235395ace2aaa5cc19e5bd27c2adf531a64c0725cf6732

Contents?: true

Size: 1014 Bytes

Versions: 51

Compression:

Stored size: 1014 Bytes

Contents

require 'puppet/util/windows'

module Puppet::Util::Windows::File
  require 'windows/api'
  require 'windows/wide_string'

  ReplaceFileWithoutBackupW = Windows::API.new('ReplaceFileW', 'PPVLVV', 'B')
  def replace_file(target, source)
    result = ReplaceFileWithoutBackupW.call(WideString.new(target.to_s),
                                   WideString.new(source.to_s),
                                   0, 0x1, 0, 0)
    return true unless result == 0
    raise Puppet::Util::Windows::Error.new("ReplaceFile(#{target}, #{source})")
  end
  module_function :replace_file

  MoveFileEx = Windows::API.new('MoveFileExW', 'PPL', 'B')
  def move_file_ex(source, target, flags = 0)
    result = MoveFileEx.call(WideString.new(source.to_s),
                             WideString.new(target.to_s),
                             flags)
    return true unless result == 0
    raise Puppet::Util::Windows::Error.
      new("MoveFileEx(#{source}, #{target}, #{flags.to_s(8)})")
  end
  module_function :move_file_ex
end

Version data entries

51 entries across 51 versions & 3 rubygems

Version Path
puppet-parse-0.1.4 lib/vendor/puppet/util/windows/file.rb
puppet-parse-0.1.3 lib/vendor/puppet/util/windows/file.rb
puppet-parse-0.1.2 lib/vendor/puppet/util/windows/file.rb
puppet-parse-0.1.1 lib/vendor/puppet/util/windows/file.rb
puppet-2.7.26 lib/puppet/util/windows/file.rb
puppet-2.7.25 lib/puppet/util/windows/file.rb
puppet-2.7.24 lib/puppet/util/windows/file.rb
puppet-3.3.2 lib/puppet/util/windows/file.rb
puppet-3.3.1 lib/puppet/util/windows/file.rb
puppet-3.3.1.rc3 lib/puppet/util/windows/file.rb
puppet-3.3.1.rc2 lib/puppet/util/windows/file.rb
puppet-3.3.1.rc1 lib/puppet/util/windows/file.rb
puppet-3.3.0 lib/puppet/util/windows/file.rb
puppet-3.3.0.rc3 lib/puppet/util/windows/file.rb
puppet-3.3.0.rc2 lib/puppet/util/windows/file.rb
puppet-3.2.4 lib/puppet/util/windows/file.rb
puppet-2.7.23 lib/puppet/util/windows/file.rb
puppet-3.2.3 lib/puppet/util/windows/file.rb
puppet-3.2.3.rc1 lib/puppet/util/windows/file.rb
puppet-3.2.2 lib/puppet/util/windows/file.rb