Changeset 12413 in project for release/3/sigma/trunk/sigma.scm


Ignore:
Timestamp:
11/09/08 02:59:17 (12 years ago)
Author:
Ivan Raikov
Message:

Updated for version 1.15.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/3/sigma/trunk/sigma.scm

    r11280 r12413  
    8484
    8585
    86 
    87 (define LIBDIR "/usr/share/sigma")
     86(define SHARED-DIR (chicken-home))
     87
     88(define SIGMA-DIR (make-pathname SHARED-DIR "sigma"))
    8889
    8990(define-constant  slide-tmpl-file  "slide-template.scm")
     
    651652
    652653;; locate and copy (if necessary) a SIGMA template file
    653 (define (locate-and-copy-template LIBDIR target-dir file-name)
     654(define (locate-and-copy-template SIGMA-DIR target-dir file-name)
    654655  (if (file-exists? (s+ target-dir dirsep file-name))
    655656      (message "Found " file-name " file.")
    656657      (begin
    657         (message "No " file-name " file; getting a copy from " LIBDIR ".")
    658         (if (directory? LIBDIR)
    659             (if (file-exists? (s+ LIBDIR dirsep file-name))
    660                 (run (cp -f ,(fpesc LIBDIR file-name) ,(fpesc target-dir file-name)))
    661                 (sigma:error (s+ LIBDIR dirsep file-name)
     658        (message "No " file-name " file; getting a copy from " SIGMA-DIR ".")
     659        (if (directory? SIGMA-DIR)
     660            (if (file-exists? (s+ SIGMA-DIR dirsep file-name))
     661                (run (cp -f ,(fpesc SIGMA-DIR file-name) ,(fpesc target-dir file-name)))
     662                (sigma:error (s+ SIGMA-DIR dirsep file-name)
    662663                             " cannot be read or does not exist."))
    663             (sigma:error LIBDIR " cannot be read or does not exist. ")))))
     664            (sigma:error SIGMA-DIR " cannot be read or does not exist. ")))))
    664665
    665666
     
    781782      (done)
    782783      (message "Sorting images by date: ")
    783       (let ((op (if (string=? image-dir target-dir) 'mv 'cp))
    784             (temp-dir (mkdtemp (s+ image-dir dirsep "sigma-tmp.XXXXXX"))))
     784      (let* ((op (if (string=? image-dir target-dir) 'mv 'cp))
     785             (temp-dir-name (s+ image-dir dirsep "sigma-tmp.XXXXXX"))
     786             (temp-dir (mkdtemp temp-dir-name)))
     787        (if (not temp-dir)
     788            (sigma:error 'sort-image ": unable to create temporary directory " temp-dir-name))
    785789        (for-each (lambda (f)
    786790                    (let ((fpath (s+ image-dir dirsep f))
     
    10831087
    10841088
    1085 (define (main-make-gallery LIBDIR index image-dir target-dir commands . rest)
     1089(define (main-make-gallery SIGMA-DIR index image-dir target-dir commands . rest)
    10861090  (let-optionals rest ((subdirs (list)) (up #f) (toplevel? #f) (slide-dir #f))
    10871091   (if (commands 'clean?)
     
    11131117                    (begin
    11141118                      ;; locate and copy the index template file, if necessary
    1115                       (locate-and-copy-template LIBDIR target-dir index-tmpl-file)
     1119                      (locate-and-copy-template SIGMA-DIR target-dir index-tmpl-file)
    11161120                      ;; locate and copy the CSS file, if necessary
    1117                       (locate-and-copy-template LIBDIR target-dir css-tmpl-file)
     1121                      (locate-and-copy-template SIGMA-DIR target-dir css-tmpl-file)
    11181122                      ;; create the index files with all the thumbnails
    11191123                      (make-toplevel-index target-dir index-tmpl-file
     
    11681172                                    (clean-targetdir target-dir)
    11691173                                    ;; locate and copy the slide template file, if necessary
    1170                                     (locate-and-copy-template LIBDIR target-dir slide-tmpl-file)
     1174                                    (locate-and-copy-template SIGMA-DIR target-dir slide-tmpl-file)
    11711175                                    (let ((slide-tmpl-path    (s+ target-dir dirsep slide-tmpl-file)))
    11721176                                      (let ((slidetmpl   (with-input-from-file slide-tmpl-path read))
     
    11831187                                                         htitle hflst hcaptions hslst opt_k opt_x opt_yslide opt_author))
    11841188                                        ;; locate and copy the index template file, if necessary
    1185                                         (locate-and-copy-template LIBDIR target-dir index-tmpl-file)
     1189                                        (locate-and-copy-template SIGMA-DIR target-dir index-tmpl-file)
    11861190                                        ;; locate and copy the CSS file, if necessary
    1187                                         (locate-and-copy-template LIBDIR target-dir css-tmpl-file)
     1191                                        (locate-and-copy-template SIGMA-DIR target-dir css-tmpl-file)
    11881192                                        (cond ((and opt_hls-main (not (null? hflst)))
    11891193                                               (let ((up-url (s+ ".." dirsep opt_html-index "." opt_html-ext)))
     
    13341338          ;; let users store their templates in a $HOME/.sigma directory, if it exists,
    13351339          ;; instead of the site-wide /usr/share/sigma
    1336           (LIBDIR   (if (directory? local-sigma-dir) local-sigma-dir LIBDIR))
     1340          (SIGMA-DIR   (if (directory? local-sigma-dir) local-sigma-dir SIGMA-DIR))
    13371341          ;; makes a directory to store slides for a CD image
    13381342          (slide-dir (and (commands 'cdimage?)
    1339                           (mkdtemp (s+ image-dir dirsep ".sigma-cdimage.XXXXXX")))))
     1343                          (let ((temp-dir-name (s+ image-dir dirsep ".sigma-cdimage.XXXXXX"))
     1344                                (temp-dir      (mkdtemp temp-dir-name )))
     1345                            (if (not temp-dir)
     1346                                (sigma:error 'main ": unable to create temporary directory " temp-dir-name))
     1347                            temp-dir))))
    13401348      (if opt_R
    13411349          (let* ((image-dir-depth   (length (string-split image-dir dirsep)))
     
    13501358                                            (cons target-dir (drop (if absolute? (cdr d) d) image-dir-depth))
    13511359                                           dirsep)))
    1352                         (main-make-gallery LIBDIR index image-dir target-dir commands
     1360                        (main-make-gallery SIGMA-DIR index image-dir target-dir commands
    13531361                                           subdirs (or (positive? lev) opt_up) opt_top
    13541362                                           slide-dir))))))
     
    13681376                         (recur (+ 1 level) d subdirs make-gallery))))
    13691377                   dirlst)))
    1370             (main-make-gallery LIBDIR index image-dir target-dir commands
     1378            (main-make-gallery SIGMA-DIR index image-dir target-dir commands
    13711379                               (read-subdirs target-dir) opt_up opt_top slide-dir))
    1372           (main-make-gallery LIBDIR index image-dir target-dir commands (list) opt_up #f slide-dir))
     1380          (main-make-gallery SIGMA-DIR index image-dir target-dir commands (list) opt_up #f slide-dir))
    13731381      (if (commands 'cdimage?)
    13741382          (begin
Note: See TracChangeset for help on using the changeset viewer.