better file renaming (don't lose that file)
This commit is contained in:
parent
6a018b60eb
commit
c54cd09e4e
1 changed files with 17 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue