Per Eckerdal wrote:
(define (current-object-file scheme-file) (let ((object-file? (let ((object-file-prefix (string-append (path-strip-directory (path-strip-extension scheme-file)) ".o"))) (lambda (file) (string-prefix? object-file-prefix file))))) (let ((object-files (sort-list (filter object-file? (directory-files (path-directory scheme-file))) string>))) (if (null? object-files) #f (first object-files)))))
I don't have the utility functions that you use in that function
Ah yes... I'm using SRFI-1 and SRFI-13. I'm using the ones from snow, but I'm not actually using snow. I just extracted the files I needed. But anyway, many thanks to Jeremie for packaging these for Gambit!
it compares strings lexicographically so if you have ten .o* files, it will choose .o2 and not .o10.
Yup.
There is also another area where this procedure doesn't model exactly what Gambit does. Gambit will load the highest number in a *contiguous* range starting from 1. I.e. if there are versions 1, 2, 3, 4, 5, it'll load 5. But if you have a "hole" in the numbers, e.g. if you remove version 3, Gambit'll load 2 as the latest version and create 3 if you compile again. However at this point, if you havent deleted versions 4 and 5, it'll load 5, not 3! :-) So don't make holes in the version list. :-)
Ed