[gambit-list] current-object-file
Per Eckerdal
per.eckerdal at gmail.com
Sun Mar 22 04:54:13 EDT 2009
> (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)))))
>
> Comments welcome.
I don't have the utility functions that you use in that function, but
if I read it correctly, it contains the same error that I made when
implementing a function that does that very thing: it compares strings
lexicographically, so if you have ten .o* files, it will choose .o2
and not .o10.
/Per
More information about the Gambit-list
mailing list