From 0a8020c06bfb0bebe3b92d876beb9548097c75ad Mon Sep 17 00:00:00 2001 From: otoburb Date: Wed, 10 Nov 2010 18:09:45 +0000 Subject: [PATCH] Fixed extra/webapps/imagebin vocab to increment path count correctly and added file detection. --- extra/webapps/imagebin/imagebin.factor | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extra/webapps/imagebin/imagebin.factor b/extra/webapps/imagebin/imagebin.factor index bb8720466c..24cd92ca2a 100644 --- a/extra/webapps/imagebin/imagebin.factor +++ b/extra/webapps/imagebin/imagebin.factor @@ -3,7 +3,8 @@ USING: accessors furnace.actions furnace.redirection html.forms http http.server http.server.dispatchers io.directories io.encodings.utf8 io.files io.pathnames -kernel math.parser multiline namespaces sequences urls ; +kernel math.parser multiline namespaces sequences urls +math ; IN: webapps.imagebin TUPLE: imagebin < dispatcher path n ; @@ -14,13 +15,13 @@ TUPLE: imagebin < dispatcher path n ; : next-image-path ( -- path ) imagebin get - [ path>> ] [ n>> number>string ] bi append-path ; + [ path>> ] [ [ 1 + ] change-n n>> number>string ] bi append-path ; M: imagebin call-responder* [ imagebin set ] [ call-next-method ] bi ; : move-image ( mime-file -- ) - next-image-path + [ next-image-path dup exists? ] [ drop ] while [ [ temporary-path>> ] dip move-file ] [ [ filename>> ] dip ".txt" append utf8 set-file-contents ] 2bi ;