diff --git a/contrib/httpd/file-responder.factor b/contrib/httpd/file-responder.factor index f877aae877..8161318c62 100644 --- a/contrib/httpd/file-responder.factor +++ b/contrib/httpd/file-responder.factor @@ -36,7 +36,7 @@ parser sequences strings ; ] if ; : serve-directory ( filename -- ) - "/" over tail? [ + dup "/" tail? [ dup "index.html" append dup exists? [ nip serve-file ] [ diff --git a/library/io/files.factor b/library/io/files.factor index 5cedcab609..7123c90fd3 100644 --- a/library/io/files.factor +++ b/library/io/files.factor @@ -6,7 +6,8 @@ styles ; ! Words for accessing filesystem meta-data. -: path+ ( path path -- path ) "/" swap append3 ; +: path+ ( path path -- path ) + over "/" tail? [ append ] [ "/" swap append3 ] if ; : exists? ( file -- ? ) stat >boolean ;