#!ruby -Ks
require "phi" ; include Phi

##  Phi::FO_COPY
##  Phi::FO_DELETE
##  Phi::FO_MOVE
##  Phi::FO_RENAME
##
##  Phi::FOF_ALLOWUNDO
##  Phi::FOF_CONFIRMMOUSE
##  Phi::FOF_FILESONLY
##  Phi::FOF_MULTIDESTFILES
##  Phi::FOF_NOCONFIRMATION
##  Phi::FOF_NOCONFIRMMKDIR
##  Phi::FOF_RENAMEONCOLLISION
##  Phi::FOF_SILENT
##  Phi::FOF_SIMPLEPROGRESS
##  Phi::FOF_WANTMAPPINGHANDLE .. not supported yet

    handle = 0 
    func = Phi::FO_DELETE
    fromPath = 'c:/1.test'
    toPath = ''
    flags = Phi::FOF_ALLOWUNDO + Phi::FOF_NOCONFIRMATION
    flags = Phi::FOF_ALLOWUNDO
    nameMapings = nil
    progressTitle = 'test title'

unless FileTest.exist? fromPath
  print "make #{fromPath} (Y/n)? " ; ans = gets || 'yes'
  if /^y/i =~ ans.chop
    File.open(fromPath,"w"){}
  end
end

ret, anyOperationsAborted, nameMapings = Phi.sh_file_operation(
    handle,
    func,
    fromPath,
    toPath,
    flags,
    progressTitle)

p "ret=#{ret}"
p "anyOperationsAborted=#{anyOperationsAborted}"
p "nameMapings=#{nameMapings}"
