[uim-commit] r300 - trunk/scm

yamaken@freedesktop.org yamaken@freedesktop.org
Fri Jan 14 23:13:41 PST 2005


Author: yamaken
Date: 2005-01-14 23:13:38 -0800 (Fri, 14 Jan 2005)
New Revision: 300

Modified:
   trunk/scm/custom-rt.scm
   trunk/scm/util.scm
Log:
* scm/util.scm
  - (try-load, try-require): New procedure for error-proof file loading
* scm/custom-rt.scm
  - (custom-load-group-conf): Replace 'load' with 'try-load' to avoid
    the crash caused by "file not found". Thanks No.52 of [Anthy/uim
    thread 5] for reporting


Modified: trunk/scm/custom-rt.scm
===================================================================
--- trunk/scm/custom-rt.scm	2005-01-15 07:08:38 UTC (rev 299)
+++ trunk/scm/custom-rt.scm	2005-01-15 07:13:38 UTC (rev 300)
@@ -59,7 +59,7 @@
 				"/.uim.d/customs/custom-"
 				group-name
 				".scm")))
-      (load path))))
+      (try-load path))))
 
 ;; full implementation
 (define require-custom

Modified: trunk/scm/util.scm
===================================================================
--- trunk/scm/util.scm	2005-01-15 07:08:38 UTC (rev 299)
+++ trunk/scm/util.scm	2005-01-15 07:13:38 UTC (rev 300)
@@ -364,6 +364,17 @@
 ;; uim-specific utilities
 ;;
 
+;; returns succeeded or not
+(define try-load
+  (lambda (file)
+    (not (*catch 'errobj (load file)))))
+
+;; returns succeeded or not
+(define try-require
+  (lambda (file)
+    (eq? (symbolconc '* (string->symbol file) '-loaded*)
+	 (*catch 'errobj (require file)))))
+
 ;; for eval
 (define toplevel-env ())
 



More information about the Uim-commit mailing list