forked from sds/overcommit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathos.rb
More file actions
36 lines (28 loc) · 635 Bytes
/
os.rb
File metadata and controls
36 lines (28 loc) · 635 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require 'rbconfig'
module Overcommit
# Methods relating to the current operating system
module OS
class << self
def windows?
!(/mswin|msys|mingw|bccwin|wince|emc/ =~ host_os).nil?
end
def cygwin?
!(/cygwin/ =~ host_os).nil?
end
def mac?
!(/darwin|mac os/ =~ host_os).nil?
end
def unix?
!windows?
end
def linux?
unix? && !mac? && !cygwin?
end
private
def host_os
@host_os ||= ::RbConfig::CONFIG['host_os'].freeze
end
end
SEPARATOR = (windows? ? '\\' : File::SEPARATOR).freeze
end
end