fix simplify-path in the case where only "." can be returned

svn: r3073
This commit is contained in:
Matthew Flatt 2006-05-26 12:18:23 +00:00
parent 684e4baf24
commit 5a449b0911
2 changed files with 12 additions and 2 deletions

View File

@ -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 "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 "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 '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 simplify-path 1 2)
(arity-test expand-path 1 1) (arity-test expand-path 1 1)

View File

@ -3450,7 +3450,7 @@ static Scheme_Object *simplify_path(int argc, Scheme_Object *argv[])
{ {
char *s; char *s;
int len, use_fs; int len, use_fs;
Scheme_Object *bs; Scheme_Object *bs, *r;
if (!SCHEME_PATH_STRINGP(argv[0])) if (!SCHEME_PATH_STRINGP(argv[0]))
scheme_wrong_type("simplify-path", SCHEME_PATH_STRING_STR, 0, argc, argv); 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])); 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[]) static Scheme_Object *current_drive(int argc, Scheme_Object *argv[])