You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pollen/project-requires.rkt

20 lines
895 B
Racket

#lang racket/base
11 years ago
(require "world.rkt")
(provide (all-defined-out))
(define (project-require-file? path)
(define path-string (path->string path))
11 years ago
(define racket-ext "rkt")
(equal? (substring path-string (- (string-length path-string) (string-length racket-ext)) (string-length path-string)) racket-ext))
;; list of all eligible requires in project require directory
(define (get-project-require-files)
(define extras-directory (build-path (world:current-project-root) world:extras-dir))
(and (directory-exists? extras-directory)
;; #:build? option returns complete paths (instead of just file names)
(let ([files (filter project-require-file? (directory-list extras-directory #:build? #t))])
11 years ago
(and (not (equal? null files)) files))))
(module+ main
(parameterize ([world:current-project-root (string->path "/Users/mb/git/bpt/")])
(get-project-require-files)))