Skip to content

Commit

Permalink
added rescue proc for writing id file
Browse files Browse the repository at this point in the history
  • Loading branch information
Isshu Rakusai committed Oct 17, 2009
1 parent 6d46ce3 commit 04da6eb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions MacOS/Gyazo.app/Contents/Resources/script
Expand Up @@ -2,15 +2,19 @@

require 'net/http'

program = ARGV[0]
program = ARGV[0].to_s
idfile = File.dirname(program) + "/gyazo.app/Contents/Resources/id"

id = ''
if File.exist?(idfile) then
id = File.read(idfile).chomp
else
id = Time.new.strftime("%Y%m%d%H%M%S")
File.open(idfile,"w").print(id+"\n")
begin
File.open(idfile,"w").print(id+"\n")
rescue
id = ""
end
end

tmpfile = "/tmp/image_upload#{$$}.png"
Expand Down

0 comments on commit 04da6eb

Please sign in to comment.