* src/scm/path.scm: version the .gnucash/config* files.

* src/scm/: change several other files to use versioned config


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3966 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-04-14 10:13:49 +00:00
parent 131ef51c62
commit 27ab138fa8
6 changed files with 30 additions and 25 deletions

View File

@ -1,5 +1,9 @@
2001-04-14 Dave Peticolas <dave@krondo.com>
* src/scm/path.scm: version the .gnucash/config* files.
* src/scm/: change several other files to use versioned config
* src/gnome/window-main.c: show current filename in app titles
2001-04-13 Bill Gribble <grib@billgribble.com>

View File

@ -31,7 +31,7 @@
;;; setting is considered transient. Other settings (like from the UI
;;; preferences panel, or normal user code) should be considered
;;; permanent, and if they leave the variable value different from the
;;; default, should be saved to ~/.gnucash/config.auto.
;;; default, should be saved to the auto configuration file.
(gnc:support "config-var.scm")

View File

@ -128,7 +128,7 @@
(record-accessor <html-style-sheet> 'style))
(define (gnc:save-style-sheet-options)
(let ((port (open (build-path (getenv "HOME") ".gnucash" "config.auto")
(let ((port (open gnc:current-config-auto
(logior O_WRONLY O_CREAT O_APPEND))))
(hash-fold
(lambda (id ss-obj p)

View File

@ -47,10 +47,10 @@
((current)
(gnc:config-var-value-get gnc:*doc-path*))
(else
(gnc:warn "bad item " item " in doc-path. Ignoring.")
(gnc:warn "bad item " item " in doc-path. Ignoring.")
'())))
(else
(gnc:warn "bad item " item " in doc-path. Ignoring.")
(gnc:warn "bad item " item " in doc-path. Ignoring.")
'())))))
(apply append (map path-interpret new-path))))
@ -58,30 +58,31 @@
(let ((home-dir (build-path (getenv "HOME") ".gnucash")))
(if (access? home-dir X_OK) #t (mkdir home-dir #o700))))
(define gnc:current-config-auto
(build-path (getenv "HOME") ".gnucash" "config-1.6.auto"))
(define gnc:load-user-config-if-needed
(let ((user-config-loaded? #f))
(define (try-load file-suffix)
(let ((file (build-path (getenv "HOME") ".gnucash" file-suffix)))
(if (access? file F_OK)
(if (false-if-exception (primitive-load file))
(begin
(set! user-config-loaded? #t)
#t)
(begin
(gnc:warn "failure loading " user-file)
#f))
#f)))
(lambda ()
(if (not user-config-loaded?)
(begin
(gnc:debug "loading user configuration")
(let ((user-file
(build-path (getenv "HOME") ".gnucash" "config.user"))
(auto-file
(build-path (getenv "HOME") ".gnucash" "config.auto")))
(if (access? user-file F_OK)
(if (false-if-exception (primitive-load user-file))
(set! user-config-loaded? #t)
(begin
(gnc:warn "failure loading " user-file)
#f))
(if (access? auto-file F_OK)
(if (false-if-exception (primitive-load auto-file))
(set! user-config-loaded? #t)
(begin
(gnc:warn "failure loading " auto-file)
#f))))))))))
(or-map try-load
'("config-1.6.user" "config.user"
"config-1.6.auto" "config.auto")))))))
;; the system config should probably be loaded from some directory
;; that wouldn't be a site wide mounted directory, like /usr/share

View File

@ -82,7 +82,7 @@
(gnc:save-style-sheet-options))
(define (gnc:save-acct-tree-options)
(let ((port (open (build-path (getenv "HOME") ".gnucash" "config.auto")
(let ((port (open gnc:current-config-auto
(logior O_WRONLY O_CREAT O_APPEND)))
(maxid 0))
(hash-fold
@ -104,7 +104,7 @@
(gnc:make-home-dir)
(gnc:save-options gnc:*options-entries*
(symbol->string 'gnc:*options-entries*)
(build-path (getenv "HOME") ".gnucash" "config.auto")
gnc:current-config-auto
(string-append
"(gnc:config-file-format-version 1)\n\n"
";"

View File

@ -112,7 +112,7 @@
(hash-for-each add-report-menu-item *gnc:_report-templates_*))
(define (gnc:save-report-options)
(let ((port (open (build-path (getenv "HOME") ".gnucash" "config.auto")
(let ((port (open gnc:current-config-auto
(logior O_WRONLY O_CREAT O_APPEND))))
(hash-fold
(lambda (id report-obj p)