macocio
2018-11-17 21:15:34

Any way to get the current-directory of a module? Invoking current-directory only appears to return the working directory of the program.


macocio
2018-11-17 21:21:54

Found syntax-source-module which appears to work! :smile:


macocio
2018-11-17 22:03:47

I’m building a macro to require files recursively from child directories, but it doesn’t appear to actually require things.


macocio
2018-11-17 22:04:43

macocio
2018-11-17 22:25:11

Nvm got it to work, was in the wrong transformer environment >.<


macocio
2018-11-17 22:58:23

So is there any easy way for all racket files in a certain subdir to automatically require one other file without making your own #lang?


samth
2018-11-18 01:51:16

@macocio you probably want (define-runtime-path something ".")


samth
2018-11-18 01:52:08

also, you can write a macro (do-the-thing) that requires the other file if it’s used in a particular directory


samth
2018-11-18 01:52:26

and as you note you could make a custom language that inserts a call to (do-the-thing).


macocio
2018-11-18 01:53:33

@samth it could be interesting to let the top-level requirer add requires to modules which it itself requires…


macocio
2018-11-18 01:54:22

I currently use a macro to require subdirectories for a utils library, where I just wanna chuck code into a nice hierarchy but include everything when I use the utils library (because require boilerplate bores me)


lexi.lambda
2018-11-18 02:03:46

Why not just make a utils.rkt module that requires and reprovides everything in the utils/ subdirectory?


macocio
2018-11-18 02:05:37

@lexi.lambda that’s what it does, but it recurses all the way down the dir hierarchy rn.


macocio
2018-11-18 02:06:12

I’d just like my code that uses utils.rkt in - say - actual-program/ to automatically require "utils.rkt", that’d be cool