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 :

https://github.com/DexterLagan/compile-to-standalone-quick/blob/master/compile-to-standalone.rkt


  Any help would be appreciated.

Dex

-- 
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 
https://groups.google.com/d/msgid/racket-users/CACUENrKjUJ_zG7qu2NnNDUU%3D_7bLbD4%2B6q%2BkVui2DYQ7yZw0Zw%40mail.gmail.com.

Reply via email to