From 5a449b0911708791e17dc0a30c29cc0261e8e83b Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 26 May 2006 12:18:23 +0000 Subject: [PATCH] fix simplify-path in the case where only "." can be returned svn: r3073 --- collects/tests/mzscheme/path.ss | 3 +++ src/mzscheme/src/file.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/collects/tests/mzscheme/path.ss b/collects/tests/mzscheme/path.ss index 9737c152da..89c5e823b1 100644 --- a/collects/tests/mzscheme/path.ss +++ b/collects/tests/mzscheme/path.ss @@ -380,6 +380,9 @@ (test (build-path 'up "x" "y") simplify-path (build-path 'up "x" "z" 'up "y") #f) (test (build-path 'up "x" "y") simplify-path (build-path 'up 'same "x" "z" 'up "y") #f) (test (build-path 'up 'up "x" "y") simplify-path (build-path 'up 'same 'up "x" "z" 'up "y") #f) +(test (build-path 'same) simplify-path (build-path 'same) #f) +(test (build-path 'same) simplify-path (build-path 'same 'same 'same) #f) +(test (build-path 'same) simplify-path (build-path 'same "a" 'same 'up 'same) #f) (arity-test simplify-path 1 2) (arity-test expand-path 1 1) diff --git a/src/mzscheme/src/file.c b/src/mzscheme/src/file.c index ec045fe09b..8953b4eefb 100644 --- a/src/mzscheme/src/file.c +++ b/src/mzscheme/src/file.c @@ -3450,7 +3450,7 @@ static Scheme_Object *simplify_path(int argc, Scheme_Object *argv[]) { char *s; int len, use_fs; - Scheme_Object *bs; + Scheme_Object *bs, *r; if (!SCHEME_PATH_STRINGP(argv[0])) scheme_wrong_type("simplify-path", SCHEME_PATH_STRING_STR, 0, argc, argv); @@ -3465,7 +3465,14 @@ static Scheme_Object *simplify_path(int argc, Scheme_Object *argv[]) use_fs = ((argc <= 1) || SCHEME_TRUEP(argv[1])); - return do_simplify_path(bs, scheme_null, 0, use_fs, 0); + r = do_simplify_path(bs, scheme_null, 0, use_fs, 0); + + if (SCHEME_FALSEP(r)) { + /* Input was just 'same: */ + return scheme_make_path("."); + } + + return r; } static Scheme_Object *current_drive(int argc, Scheme_Object *argv[])