Handle relative selectors.
[scratchy.git] / scratchy.scm
index cd4fa8e..12c7094 100644 (file)
@@ -20,7 +20,7 @@
 
 ;;; Global constants
 
-(define scratchy-version "1.3.0")
+(define scratchy-version "1.4.1")
 
 (define scratchy-footer
   (conc "\n"
     (if (legal-script-filename? filename config)
         (let* ((sexp (with-input-from-file filename read))
                (script-result (with-selector-dir
-                               selector config
+                               (pathname-directory selector) config
                                (lambda ()
                                  (apply (eval sexp) arguments)))))
           (when (pair? script-result)
                    dir-selector config))
     ((type display-string selector)
      (serve-record (list type display-string
-                         (make-pathname dir-selector selector)
+                         (normalize-pathname (make-pathname dir-selector selector))
                          (config-host config) (config-port config))
                    dir-selector config))
     ((display-string selector)
 (define (main)
   (let* ((progname (pathname-file (car (argv))))
          (config (make-config '() '() 70 #t '() '() '() '())))
-    (if (null? (cdr (argv)))
+    (if (null? (command-line-arguments))
         (print-usage progname)
-        (let loop ((args (cdr (argv))))
+        (let loop ((args (command-line-arguments)))
           (let ((this-arg (car args))
                 (rest-args (cdr args)))
             (if (string-prefix? "-" this-arg)