Skip to content

Commit

Permalink
Check if ruby-uuid is writable
Browse files Browse the repository at this point in the history
* It might have been claimed by another user on the system already
  • Loading branch information
loafoe committed Jul 19, 2011
1 parent d83f26d commit ce8e579
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
uuid (2.3.1)
uuid (2.3.2)
macaddr (~> 1.0)

GEM
Expand Down
6 changes: 3 additions & 3 deletions lib/uuid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ def self.state_file(mode = 0644)
state_dir = File.join('', 'var', 'tmp')
end

if File.writable?(state_dir) then
@state_file = File.join(state_dir, 'ruby-uuid')
else
@state_file = File.join(state_dir, 'ruby-uuid')

if !File.writable?(state_dir) || (File.exists?(@state_file) && !File.writabe?(@state_file)) then
@state_file = File.expand_path('.ruby-uuid', '~')
end

Expand Down

0 comments on commit ce8e579

Please sign in to comment.