jestarray
2021-2-22 17:48:10

https://docs.racket-lang.org/reference/file-ports.html?q=call-with-output-file#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._call-with-output-file%29%29 is there a way to configure these flags such that (call-with-output-file (build-path 'up "test" "test.txt") does not crash if it tries to write to a directory that does not exist?


soegaard2
2021-2-22 17:49:05

By “crash” do you mean “throw an exception”?


jestarray
2021-2-22 17:49:09

yep


soegaard2
2021-2-22 17:51:02

I see two options: 1. Use directory-exists? first. 2. Do as you do now, but use with-handlers to catch the exception.


jestarray
2021-2-22 17:51:32

ahh k, ill just check if it exists then beforehand


sorawee
2021-2-22 17:52:47

Another option is to always create the directory first whether it exists already by using make-directory*


sorawee
2021-2-22 17:53:10

Of course, it depends on what you want to do. Might not be desirable if you don’t want to create the directory


jestarray
2021-2-22 19:02:53

https://github.com/jeapostrophe/racket-langserver/issues/29 if someone implements this i will love you forever :kissing_heart: . like we should just start funding racket ide tools