better file renaming (don't lose that file)

This commit is contained in:
Ward Wouts 2002-08-06 23:07:25 +00:00
parent 6a018b60eb
commit c54cd09e4e

View file

@ -53,6 +53,20 @@ def save_file(dir, name, data)
print "couldn't open file for writeing\n"
return false
end
when "Tempfile"
begin
if File.rename(data.path, "#{dir}/#{newname}")
print " Saving as: '#{newname}'\n"
else
print "couldn't rename tempfile\n"
return false
end
rescue Errno::ENOENT
print "Caught Errno::ENOENT (save_file)\n"
print "Error: #{$!}\n"
print "What the #@$$ happended?\n"
return false
end
else
print "EEEEPS Can't save data of type: #{data.type.to_s}\n"
return false
@ -252,6 +266,9 @@ def get_multi(subj, group)
end
return false unless check_ext(filename, "m")
body = fileout.path
bodybase = body.sub(/\/[^\/]*$/, "")
File.rename(body, "#{bodybase}/ripnewsdecode")
body = "#{bodybase}/ripnewsdecode"
file.close
fileout.close(false)
return mode, filename, body