[Gnucash-changes] Auto-load a new "saved reports" config file.

Derek Atkins warlord at cvs.gnucash.org
Fri Jun 18 12:47:11 EDT 2004


Log Message:
-----------
Auto-load a new "saved reports" config file.

	* src/scm/paths.scm: create gnc:current-saved-reports, as
	  the file to store saved reports from cstim.  Autoload the
	  saved-reports file at startup (after config.user/config.auto
	  is loaded).	  
	* src/scm/main.scm: export gnc:current-saved-reports

Tags:
----
gnucash-1-8-branch

Modified Files:
--------------
    gnucash:
        ChangeLog
    gnucash/src/scm:
        main.scm
        path.scm

Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1461.2.337
retrieving revision 1.1461.2.338
diff -LChangeLog -LChangeLog -u -r1.1461.2.337 -r1.1461.2.338
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,11 @@
+2004-06-18  Derek Atkins  <derek at ihtfp.com>
+
+	* src/scm/paths.scm: create gnc:current-saved-reports, as
+	  the file to store saved reports from cstim.  Autoload the
+	  saved-reports file at startup (after config.user/config.auto
+	  is loaded).	  
+	* src/scm/main.scm: export gnc:current-saved-reports
+
 2004-05-31  Linas Vepstas <linas at linas.org>
 	* src/...:
 	  Backport of CVS-head changes to improve register open 
Index: main.scm
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/scm/main.scm,v
retrieving revision 1.107.2.4
retrieving revision 1.107.2.5
diff -Lsrc/scm/main.scm -Lsrc/scm/main.scm -u -r1.107.2.4 -r1.107.2.5
--- src/scm/main.scm
+++ src/scm/main.scm
@@ -61,6 +61,7 @@
 ;; from path.scm
 (export gnc:make-home-dir)
 (export gnc:current-config-auto)
+(export gnc:current-saved-reports)
 
 ;; from command-line.scm
 (export gnc:*config-path*)
Index: path.scm
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/scm/path.scm,v
retrieving revision 1.18
retrieving revision 1.18.2.1
diff -Lsrc/scm/path.scm -Lsrc/scm/path.scm -u -r1.18 -r1.18.2.1
--- src/scm/path.scm
+++ src/scm/path.scm
@@ -42,21 +42,30 @@
 (define gnc:current-config-auto
   (build-path (getenv "HOME") ".gnucash" "config-1.8.auto"))
 
+(define gnc:current-saved-reports
+  (build-path (getenv "HOME") ".gnucash" "saved-reports-1.8"))
+
 (define gnc:load-user-config-if-needed
   (let ((user-config-loaded? #f))
 
-    (define (try-load file-suffix)
+    (define (try-load-no-set file-suffix)
       (let ((file (build-path (getenv "HOME") ".gnucash" file-suffix)))
+	(gnc:debug "trying to load " file)
         (if (access? file F_OK)
             (if (false-if-exception (primitive-load file))
-                (begin
-                  (set! user-config-loaded? #t)
-                  #t)
+		#t
                 (begin
                   (gnc:warn "failure loading " file)
                   #f))
             #f)))
 
+    (define (try-load file-suffix)
+      (if (try-load-no-set file-suffix)
+	  (begin
+	    (set! user-config-loaded? #t)
+	    #t)
+	  #f))
+
     (lambda ()
       (if (not user-config-loaded?)
           (begin
@@ -66,7 +75,11 @@
 		    ;; rolls around bump the 1.4 (unnumbered) files
 		    ;; off the list.
                     '("config-1.8.user" "config-1.6.user" "config.user"
-                      "config-1.8.auto" "config-1.6.auto" "config.auto")))))))
+                      "config-1.8.auto" "config-1.6.auto" "config.auto"))
+	    (gnc:debug "loading saved reports")
+	    (or-map try-load-no-set
+		    '("saved-reports-1.8"))
+	    )))))
 
 ;; the system config should probably be loaded from some directory
 ;; that wouldn't be a site wide mounted directory, like /usr/share


More information about the gnucash-changes mailing list