(Ruby 1.8.6 under Windows)

My application creates a series of temporary files. I decided to use
the tempfile module of Ruby, but I needed to control the file extension
of the generated temporary file (should end in .xml). I came up with
the following solution:

    file=Tempfile.new('.tempreq','/thome/requests')
    file << '....' # populate the file
    path=file.path # remember the generated filename
    file.close
    result=path+'.xml' # add desired extension to the filename
    File.rename(path,result) # rename file 
    at_exit { File::delete(result) } # remove file at exit

When the exit handler jumps into action, I get however the following
error:

H:\thome\grubylib/TfwCommon.rb:433:in `delete': Permission denied -
/thome/requests/.tempr
eq.3176.0.xml (Errno::EACCES)

After the program has ended, I can however erase the file from the
command line with
no problems. Why do I get a "permission denied" here? Is there a better
way to 
achieve my goal?

Ronald
-- 
Ronald Fischer <ronald.fischer / venyon.com>
Phone: +49-89-452133-162