diff options
Diffstat (limited to 'lib/rbot/utils.rb')
-rw-r--r-- | lib/rbot/utils.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/rbot/utils.rb b/lib/rbot/utils.rb index ae45e5d5..d1052390 100644 --- a/lib/rbot/utils.rb +++ b/lib/rbot/utils.rb @@ -320,9 +320,15 @@ module Irc end + @@safe_save_dir = nil + def Utils.set_safe_save_dir(str) + @@safe_save_dir = str.dup + end + def Utils.safe_save(file) + raise 'No safe save directory defined!' if @@safe_save_dir.nil? basename = File.basename(file) - temp = Tempfile.new(basename) + temp = Tempfile.new(basename,@@safe_save_dir) temp.binmode yield temp if block_given? temp.close |