fix resolve-path to always return a path (not a string)

Closes #1132
This commit is contained in:
Matthew Flatt 2016-03-07 14:28:06 -07:00
parent e90e587a91
commit ffbae2c090
2 changed files with 26 additions and 1 deletions

View File

@ -1814,4 +1814,29 @@
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(let ([tf (make-temporary-file)])
(test tf resolve-path (path->string tf))
(unless (eq? 'windows (system-type))
(delete-file tf)
(make-file-or-directory-link "other.txt" tf)
(test (string->path "other.txt") resolve-path tf))
(delete-file tf)
(case (system-path-convention-type)
[(unix)
(test (string->path "/testing-root/testing-dir/testing-file")
resolve-path
"//testing-root/testing-dir/testing-file")
(test (string->path "/testing-root/testing-dir/testing-file")
resolve-path
"//testing-root////testing-dir//testing-file")]
[(windows)
(test (string->path "C:/testing-root/testing-dir/testing-file")
resolve-path
"C://testing-root/testing-dir/testing-file")
(test (string->path "C:/testing-root/testing-dir\\testing-file")
resolve-path
"C://testing-root////testing-dir\\\\testing-file")]))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(report-errs) (report-errs)

View File

@ -4617,7 +4617,7 @@ static Scheme_Object *do_resolve_path(int argc, Scheme_Object *argv[], int guard
return scheme_make_sized_path(buffer, len, 1); return scheme_make_sized_path(buffer, len, 1);
} }
if (!expanded) if (!expanded && SCHEME_PATHP(argv[0]))
return argv[0]; return argv[0];
else else
return scheme_make_sized_path(filename, strlen(filename), 1); return scheme_make_sized_path(filename, strlen(filename), 1);