Changeset 12413 in project


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

Updated for version 1.15.

Location:
release/3/sigma/trunk
Files:
3 edited

Legend:

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

    r11282 r12413  
    3636
    3737     (history
     38      (version "1.15" "Added some error checking for temporary directory creation")
    3839      (version "1.14" "Another bug fix in directory path escaping")
    3940      (version "1.12" "Bug fix in directory path escaping")
     
    180181
    181182     (license
    182       "Copyright 2007 Ivan Raikov.
     183      "Copyright 2007-2008 Ivan Raikov.
    183184
    184185Based on the igal program by Eric Pop. 
  • 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
  • release/3/sigma/trunk/sigma.setup

    r11282 r12413  
    1010
    1111  ; Assoc list with properties for the program:
    12   '((version 1.14)
     12  '((version 1.15)
    1313    (documentation "sigma.html")))
    1414
     15;; From setup-header.scm by Kon Lovett
    1516
    16 (create-directory "/usr/share/sigma")
    17 (copy-file "sigma.html" "/usr/share/sigma")
    18 (copy-file "sigma.css"  "/usr/share/sigma")
    19 (copy-file "index-template.scm" "/usr/share/sigma")
    20 (copy-file "slide-template.scm" "/usr/share/sigma")
     17;;; Constants & Procedures
     18
     19(define SHARED-DIR (chicken-home))
     20
     21(define SIGMA-DIR (make-pathname SHARED-DIR "sigma"))
     22
     23
     24;; File Copy Operations
     25
     26(define (*file-copy fn dn)
     27  (let ([fn (->string fn)])
     28    (copy-file fn (make-pathname dn fn)) ) )
     29
     30(define (copy-to-shared fn)
     31  (*file-copy (->string fn) (chicken-home)) )
     32
     33(define (copy-file-to-sigma-dir fn)
     34  (*file-copy (->string fn) SIGMA-DIR) )
     35
     36(if (not (file-exists? SIGMA-DIR))
     37    (create-directory SIGMA-DIR))
     38
     39(copy-file-to-sigma-dir "sigma.html" )
     40(copy-file-to-sigma-dir "sigma.css" )
     41(copy-file-to-sigma-dir "index-template.scm")
     42(copy-file-to-sigma-dir "slide-template.scm")
Note: See TracChangeset for help on using the changeset viewer.