Module: Puppet::Util::Windows::File
- Defined in:
- lib/vendor/puppet/util/windows/file.rb
Constant Summary collapse
- ReplaceFileWithoutBackupW =
Windows::API.new('ReplaceFileW', 'PPVLVV', 'B')
- MoveFileEx =
Windows::API.new('MoveFileExW', 'PPL', 'B')
Class Method Summary collapse
Class Method Details
.move_file_ex(source, target, flags = 0) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/vendor/puppet/util/windows/file.rb', line 18 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 |
.replace_file(target, source) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/vendor/puppet/util/windows/file.rb', line 8 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 |