Cross-platform check for absolute filepath.

This commit is contained in:
Jeff Hodges 2009-05-30 21:12:40 -07:00
parent 97e2133282
commit 820c9df1b0

View File

@ -1,4 +1,5 @@
require 'fileutils' require 'fileutils'
require 'pathname'
RealFile = File RealFile = File
RealFileUtils = FileUtils RealFileUtils = FileUtils
@ -240,7 +241,7 @@ module FakeFS
end end
def normalize_path(path) def normalize_path(path)
if path[0,1] == '/' if Pathname.new(path).absolute?
File.expand_path(path) File.expand_path(path)
else else
parts = dir_levels + [path] parts = dir_levels + [path]