Skip to content

Commit 116c879

Browse files
committedJun 15, 2012
Windows: fix tmpdir?
1 parent f9d921e commit 116c879

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed
 

‎lib/fakefs/dir.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ def self.open(string, &block)
120120
end
121121

122122
def self.tmpdir
123-
'/tmp'
123+
if OS.windows?
124+
'C:\Users\Admin\AppData\Local\Temp'
125+
else
126+
'/tmp'
127+
end
124128
end
125129

126130
def self.pwd

‎lib/fakefs/os.rb

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module OS
2+
def OS.windows?
3+
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
4+
end
5+
6+
def OS.mac?
7+
(/darwin/ =~ RUBY_PLATFORM) != nil
8+
end
9+
10+
def OS.unix?
11+
!OS.windows?
12+
end
13+
14+
def OS.linux?
15+
OS.unix? and not OS.mac?
16+
end
17+
end

0 commit comments

Comments
 (0)
Please sign in to comment.