+ Compute file-info of fs-object lazily
+ Capture exceptions during file-info and put #f into fs-object-info in this case + Handle fs-object-info = #f in browse-directory-list
This commit is contained in:
		
							parent
							
								
									d592b417e9
								
							
						
					
					
						commit
						84b5fec438
					
				| 
						 | 
				
			
			@ -19,6 +19,8 @@
 | 
			
		|||
  (let ((name (fs-object-name fs-object))
 | 
			
		||||
	(info (fs-object-info fs-object)))
 | 
			
		||||
    (cond
 | 
			
		||||
     ((not info)
 | 
			
		||||
      (string-append " " name ": error during file-info!"))
 | 
			
		||||
     ((file-info-directory? info)
 | 
			
		||||
      (string-append " " name "/"))
 | 
			
		||||
     ((file-info-executable? info)
 | 
			
		||||
| 
						 | 
				
			
			@ -91,7 +93,7 @@
 | 
			
		|||
      (make-browser-for-dir parent num-lines)))
 | 
			
		||||
   (else
 | 
			
		||||
    (let ((fi (fs-object-info selected-entry)))
 | 
			
		||||
      (if (file-info-directory? fi)
 | 
			
		||||
      (if (and fi (file-info-directory? fi))
 | 
			
		||||
	  (make-browser-for-dir (fs-object-complete-path selected-entry)
 | 
			
		||||
				num-lines)
 | 
			
		||||
	  state)))))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,12 +3,20 @@
 | 
			
		|||
  fs-object?
 | 
			
		||||
  (name fs-object-name)
 | 
			
		||||
  (path fs-object-path)
 | 
			
		||||
  (info fs-object-info))
 | 
			
		||||
  (info really-fs-object-info))
 | 
			
		||||
 | 
			
		||||
(define (fs-object-info fso)
 | 
			
		||||
  (force (really-fs-object-info fso)))
 | 
			
		||||
 | 
			
		||||
(define (make-fs-object name path)
 | 
			
		||||
  (really-make-fs-object 
 | 
			
		||||
   name path 
 | 
			
		||||
   (file-info (combine-path path name))))
 | 
			
		||||
   (delay
 | 
			
		||||
     (with-fatal-error-handler
 | 
			
		||||
      (lambda (condition more)
 | 
			
		||||
        (format #t "condition while fs-object-info: ~a"  condition)
 | 
			
		||||
        #f)
 | 
			
		||||
      (file-info (combine-path path name))))))
 | 
			
		||||
 | 
			
		||||
(define-record-discloser :fs-object
 | 
			
		||||
  (lambda (r)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -124,6 +124,8 @@
 | 
			
		|||
(define-structure fs-object fs-object-interface
 | 
			
		||||
  (open scheme
 | 
			
		||||
	(subset scsh (file-info))
 | 
			
		||||
        formats
 | 
			
		||||
        handle-fatal-error
 | 
			
		||||
	define-record-types)
 | 
			
		||||
  (files fs-object))
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue