From 380603cc184cbe9baf32cfeeb275594231d988e4 Mon Sep 17 00:00:00 2001 From: Troels Date: Sun, 12 Jul 2009 13:50:47 +0200 Subject: [PATCH] File#expand_path doesn't resolve symlinks. Pathname#realpath does --- filesystem/realpath.markdown | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/filesystem/realpath.markdown b/filesystem/realpath.markdown index 67f657d..e012603 100644 --- a/filesystem/realpath.markdown +++ b/filesystem/realpath.markdown @@ -8,7 +8,8 @@ }} {{code:ruby - abs_path = File.expand_path('../to/foobar') + require 'pathname' + abs_path = Pathname.new('../to/foobar').realpath.to_s p abs_path #=> "/absolute/path/to/foobar"