From 820c9df1b0b23e4e125d302ed27cf38e99af5f46 Mon Sep 17 00:00:00 2001 From: Jeff Hodges Date: Sat, 30 May 2009 21:12:40 -0700 Subject: [PATCH] Cross-platform check for absolute filepath. --- lib/fakefs.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/fakefs.rb b/lib/fakefs.rb index f63a5c1..a115331 100644 --- a/lib/fakefs.rb +++ b/lib/fakefs.rb @@ -1,4 +1,5 @@ require 'fileutils' +require 'pathname' RealFile = File RealFileUtils = FileUtils @@ -240,7 +241,7 @@ module FakeFS end def normalize_path(path) - if path[0,1] == '/' + if Pathname.new(path).absolute? File.expand_path(path) else parts = dir_levels + [path]