Fixed extra/webapps/imagebin vocab to increment path count correctly and added file detection.
parent
cefb541c33
commit
0a8020c06b
|
@ -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 ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue