The path is fine. `ext` however is always void. get-current-platforms-icon-ext is incorrect, you don't need quotes around the platform names.
Also, the error message is incomplete, I am not sure if there was scroll bar, but the contract failure should have told you which argument was wrong. Alex. On Sunday, May 3, 2020 at 4:45:44 PM UTC+8, Dexter Lagan wrote: > > 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/109c94cb-7224-42ba-acca-79a9cb022600%40googlegroups.com.

