fix file moveing bug

This commit is contained in:
Ward Wouts 2003-06-16 10:56:11 +00:00
parent cfc379c1cb
commit 5998913c87
2 changed files with 7 additions and 5 deletions

View file

@ -1,9 +1,10 @@
#!/usr/local/bin/ruby -w
# $Dwarf: ripnews.rb,v 1.63 2003/05/27 19:12:46 ward Exp $
# $Dwarf: ripnews.rb,v 1.64 2003/06/15 22:01:43 ward Exp $
# $Source$
require 'date'
require 'ftools'
require 'time'
require 'getoptlong'
require 'news/article'
@ -36,7 +37,7 @@ def save_file(dir, name, data)
case data.type.to_s
when "String"
begin
if File.rename(data, "#{dir}/#{newname}")
if File.move(data, "#{dir}/#{newname}")
print " Saving as: '#{newname}'\n"
else
print "couldn't rename tempfile\n"
@ -58,7 +59,7 @@ def save_file(dir, name, data)
end
when "Tempfile"
begin
if File.rename(data.path, "#{dir}/#{newname}")
if File.move(data.path, "#{dir}/#{newname}")
print " Saving as: '#{newname}'\n"
else
print "couldn't rename tempfile\n"
@ -340,7 +341,7 @@ def get_multi(subj, group)
end
body = fileout.path
bodybase = body.sub(/\/[^\/]*$/, "")
File.rename(body, "#{bodybase}/ripnewsdecode")
File.move(body, "#{bodybase}/ripnewsdecode")
body = "#{bodybase}/ripnewsdecode"
file.close
fileout.close(false)