Hello Sunday coders,

  So I made a QuickScript to compile to standalone executable in a
platform-independent manner - without zipping. It works great, and Laurent
gave me a hand with the file browsing part for Linux. However I'm
encountering a hard to track runtime error with find-files. I am listing
all files with a certain extension. In the past I have used string-suffix?
for this, but I found out about path-has-extension? and attempted to use it
instead. I'm getting an error with both. Here's the code :

;; find files of a given extension recursively from the current directory
(define (find-files/ext path ext)
  (define (ext-file? f)
    (and (not (void? f))
         (or (path? f) (string? f))
         (file-exists? f)
         (path-has-extension? f ext)))
  (find-files ext-file? path))

The error I'm getting should not be possible. I have added all these checks
to try and catch it, to no avail:

[image: Capture.PNG]

;; same as previous, but using string-suffix?
(define (find-files/ext# path ext)
  (define (ext-file? f)
    (and (not (void? f))
         (or (path? f) (string? f))
         (file-exists? f)
         (string-suffix? (path->string f) ext)))
  (find-files ext-file? path))

When using string-suffix?, I'm getting a different error:

[image: Capture2.PNG]
  I have used find-files many times over the years and I have never seen
this. The start-path is issued from (path-only f), where f is the source
file path given by QuickScript for the current source file.
If you're testing this code, note that when using path-has-extension?, the
icon file extension constants have to be prefixed with '#' to comply with
the function's param type.
Here's the full source :


  Any help would be appreciated.


You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Reply via email to