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,4 +1,4 @@
# $Dwarf: CHANGELOG,v 1.23 2003/05/24 12:09:18 ward Exp $
# $Dwarf: CHANGELOG,v 1.24 2003/06/15 22:28:28 ward Exp $
# $Source$
from 0.2.1 to 0.2.2
@ -8,6 +8,7 @@ from 0.2.1 to 0.2.2
- catch another error
- fetch subjects sorted so you get a better chance at getting
full series
- now your TEMPDIR can be on another drive than your DATADIR
from 0.2.0 to 0.2.1
- fail gracefully at a lack of configuration

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)