From 5d7faf4c72bb3e8e17f68fb7988317816dfe6dfd Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sun, 18 Aug 2013 13:54:00 -0500 Subject: [PATCH] fix a bug introduced in efd26833015a The bug meant that teachpacks whose names ended in the extension .ss didn't work right. --- .../htdp-lib/lang/run-teaching-program.rkt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pkgs/htdp-pkgs/htdp-lib/lang/run-teaching-program.rkt b/pkgs/htdp-pkgs/htdp-lib/lang/run-teaching-program.rkt index ccb9f20f40..0771e80fd9 100644 --- a/pkgs/htdp-pkgs/htdp-lib/lang/run-teaching-program.rkt +++ b/pkgs/htdp-pkgs/htdp-lib/lang/run-teaching-program.rkt @@ -103,13 +103,25 @@ values (for/list ([tp (in-list teachpacks)]) (cond - [(with-handlers ((exn:fail? (λ (x) #f))) - (file-exists? (resolve-module-path tp #f))) + [(has-a-file? tp) (stepper-skip (datum->syntax #f `(require ,tp)))] [else (eprintf "~a\n" (missing-tp-message tp))])))) +(define (has-a-file? tp) + (define pth + (with-handlers ((exn:fail? (λ (x) #f))) + (resolve-module-path tp #f))) + (and pth + (or (file-exists? pth) + (file-exists? + (bytes->path (regexp-replace #rx#"[.]rkt$" + (path->bytes pth) + #".ss")))))) + + + (define (missing-tp-message x) (format "the teachpack '~s' was not found" x))